HLSL pragma target command reference
Reference for the shader models Unity uses, and the combination of pragma values that each corresponds to.
阅读时间3 分钟最后更新于 21 天前
Here is the list of shader models that Unity uses, and the combination of values that each corresponds to.
#pragma requireValue | Description | Support | Equivalent |
|---|---|---|---|
| Equivalent to DirectX shader model 2.0. Limited amount of arithmetic and texture instructions; 8 interpolators; no vertex texture sampling; no derivatives in fragment shaders; no explicit LOD texture sampling. | Works on all platforms supported by Unity. | N/A |
| Almost the same as 3.0, but with only 8 interpolators, and no explicit LOD texture sampling. | DirectX 11 feature level 9+ OpenGL 3.2+ Vulkan Metal | |
| Equivalent to DirectX shader model 3.0. . | DirectX 11 feature level 10 + OpenGL 3.2+ OpenGL ES 3.0+ Vulkan Metal | Everything in |
| Equivalent to OpenGL ES 3.0. | DirectX 11 feature level 10+ OpenGL 3.2+ OpenGL ES 3+ Vulkan Metal | Everything in |
| Equivalent to DirectX shader model 4.0, but without the requirement to support 8 MRTs. | DirectX 11 feature level 10+ Desktop OpenGL 3.x OpenGL ES 3.1 OpenGL ES 3.1 + Android Extension Pack (AEP) OpenGL 3.2+ Vulkan Metal (if no geometry stage is defined) | Everything in |
| Equivalent to OpenGL 4.1 | Desktop OpenGL 4.1 Shader model 4.0 + tessellation to match macOS 10.9 capabilities. | Everything in |
| Equivalent to OpenGL ES 3.1. | DirectX 11 feature level 11+ OpenGL 4.3+ OpenGL ES 3.1 Vulkan Metal | Everything in |
| Equivalent to OpenGL 4.1. This is the highest OpenGL level supported on a Mac. | DirectX 11 feature level 11+ OpenGL 4.1+ OpenGL ES 3.1 + AEP Vulkan Metal (if no geometry stage is defined, and no hull or domain stage is defined) | Everything in |
| Equivalent to DirectX shader model 5.0, but without the requirement to support 32 interpolators or cubemap arrays. | DirectX 11 feature level 11+ Desktop OpenGL >= 4.2 OpenGL 4.3+ OpenGL ES 3.1 + AEP Vulkan Metal (if no geometry stage is defined, and no hull or domain stage is defined) | Everything in |
For information on shader model support for console platforms, see the platform-specific documentation.
Notes:
- In the DirectX definitions, shader model 4.0 includes , and shader model 5.0 includes
mrt8andinterpolators32. Unity does not include these, for broader compatibility. To require these features, use an explicitcubearraydirective.#pragma require - If you use a target that requires but your shader does not define a geometry stage, Unity removes
geometryfrom the list of requirements at compile time.geometry - If you use a target that requires but your shader does not define a hull or domain stage, Unity removes
tessellationfrom the list of requirements at compile time.tessellation