
This means that the requirement applies only to variants that are used when any of the given keywords are enabled.įor example: #pragma target 4.0 EXAMPLE_KEYWORD OTHER_EXAMPLE_KEYWORD You can also use the #pragma target directive followed by a list of space-delimited shader keywords. To specify a shader model, use #pragma target directive. #pragma require integers mrt8 : EXAMPLE_KEYWORD In this example, the shader requires integers in all cases, and mrt8 if EXAMPLE_KEYWORD is enabled. You can use multiple #pragma require lines. This means that the requirement applies only to variants that are used when any of the given keywords are enabled.įor example: #pragma require integers mrt8 : EXAMPLE_KEYWORD OTHER_EXAMPLE_KEYWORD You can also use the #pragma require directive followed by a colon and a list of space-delimited shader keywords. For example: #pragma require integers mrt8 To specify required features, use the #pragma require directive, followed by a list of space-delimited values. Specifying GPU features or a shader model To avoid seeing this warning message, explicitly add the requirements or use an appropriate target value in your code. If the list of requirements (or the equivalent target value) does not already include these values, Unity displays a warning message when it compiles the shader, to indicate that it has added these requirements. If a shader defines a tessellation stage (with #pragma hull or #pragma domain), Unity automatically adds tessellation to the list of requirements.


It is important to correctly describe the GPU features that your shader requires. A shader model is a shorthand for a group of GPU features internally, it is the same as a #pragma require directive with the same list of features. You can specify individual GPU features with the #pragma require directive, or specify a shader model with the #pragma target directive. At runtime, Unity uses this information to determine whether a shader program is compatible with the current hardware.
/nC6HLJdjwt-7afb729b3715416d9bddee55a73578c5.png)
More info See in Glossary requires certain GPU features. You can use #pragma directives to indicate that a shader A program that runs on the GPU.
