《了解俚语.pdf》由会员分享,可在线阅读,更多相关《了解俚语.pdf(25页珍藏版)》请在三个皮匠报告上搜索。
1、Writing Shaders Today:Complexity Abounds Shader codebases have become incredibly large&complex Developers need to deploy to many platforms Shader combinatorial explosion Fragile manual data binding models New graphics techniques&neural graphics discontinuityGLSLSlangHLSLCUDAC(CPU)PyTorchOptixWGSLGLS
2、LHLSL 2018MSLSlang:Open-Source and Cross-PlatformThe Slang Developer CommunityJoin us on Discord!Developer interest continuing to grow!4700+GitHub Stars,60 active contributors1000 Discord members,lively discussion threadsTry it out on the web:https:/try.shader-slang.orgSee the documentation:https:/d
3、ocs.shader-slang.orgModern Features for Modern ShadersInterfacesVisibilityExtensionsGenericsPropertyOptionalModulesMaterial PropertiesCamera EffectsPost-ProcessingmyShader.slangModules:Organizing Your CodeBegin your module definition with module/material.slangmodule material;public struct Material p
4、ublic float4 evalBRDF(float3)/*.*/internal float4 myPrivateMethod()/*.*/private float4 m_someVar;/material.slangmodule material;public struct Material public float4 evalBRDF(float3)/*.*/internal float4 myPrivateMethod()/*.*/private float4 m_someVar;Use public declarations to create types,methods,and
5、 functions visible to importing modulesinternal declarations are only visible inside the current module.If no visibility modifier is provided,all declarations default to internalprivate declarations are only visible inside the current typeModules:Organizing Your Code/material.slangmodule material;pu
6、blic struct Material public float4 evalBRDF(float3)/*.*/internal float4 myPrivateMethod()/*.*/material.slangmodule material;public struct Material public float4 evalBRDF(float3)/*.*/internal float4 myPrivateMethod()/*.*/scene.slangimport material;struct Scene StructuredBuffer materials;void compute(