For more information, refer to Introduction to static and dynamic branching in shaders.
You can use static branching in your shadersA program that runs on the GPU. More info
See in Glossary in the following ways:
#if
, #elif
, #else
, and #endif
preprocessor directives, or #ifdef
and #ifndef
preprocessor directives to create static branches.if
statements can also be used for dynamic branches, the compiler detects the compile-time constant value and creates a static branch instead.Note: Static branching is available only in hand-coded shaders. You cannot create static branches in Shader Graph.
You can use dynamic branching in your shaders in the following ways: