Shader code blocks in ShaderLab reference
Reference for the HLSLPROGRAM, HLSLINCLUDE, CGPROGRAM, and CGINCLUDE blocks in ShaderLab.
阅读时间1 分钟最后更新于 24 天前
This page contains information about using shader code blocks. For information about writing HLSL itself, refer to Writing HLSL shader programs.
HLSL
HLSLPROGRAMHLSLINCLUDESignature | Function |
|---|---|
| Creates a shader program block. Unity adds the HLSL shader program to the pass that includes this shader program block. |
| Creates a shader include block. Unity includes this code in all shader programs that are defined in |
CG
CGPROGRAMCGINCLUDEHLSLPROGRAMHLSLINCLUDEIf you use , Unity includes several of Unity's built-in shader include files by default, enabling you to use built-in variables and functions. As a result, shaders that use might not work if you change the keyword to .
CGPROGRAMCGPROGRAMHLSLPROGRAMSignature | Function |
|---|---|
| Creates a shader program block. Unity adds the shader program to the pass that includes this shader program block. |
| Create a shader include block. Unity includes this code in all shader programs that are defined in |