Version: 2019.3
GLSL Shader programs
Niveles Objetivo de Compilación Shader

Shading language used in Unity

Unity’s shader programs uses a variant of the HLSL language. HLSL is sometimes called Cg but it’s worth bearing in mind that Unity does not use Cg.

Shader compilers

Different platforms use different shader compilers for shader program compilation as follows:

  • Windows and Microsoft platforms (DX11, DX12 and Xbox One) all use Microsoft’s HLSL compiler (currently d3dcompiler_47).
  • OpenGL Core, OpenGL ES 3, OpenGL ES 2.0 and Metal use Microsoft’s HLSL followed by bytecode translation into GLSL or Metal, using HLSLcc.
  • Otras plataformas de consola utilizan sus respectivos compiladores (por ejemplo, PSSL en PS4).
  • Surface Shaders use HLSL and MojoShader for code generation analysis step.

You can use predefined shader macros to identify which compiler Unity is using, for instance to use HLSL syntax only supported by one compiler, or to work around a compiler bug.

Véase también

GLSL Shader programs
Niveles Objetivo de Compilación Shader
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961