Branch in a shader via built-in macros
Branch based on shader model

Branch based on platform or graphics API

Macro: Target platform:
SHADER_API_D3D11 Direct3D 11
SHADER_API_GLCORE Desktop OpenGL “core” (GL 3/4)
SHADER_API_GLES3 OpenGL ES 3.0/3.1
SHADER_API_METAL iOS/Mac Metal
SHADER_API_VULKAN Vulkan
SHADER_API_D3D11_9X Direct3D 11 “feature level 9.x” target for Universal Windows Platform
SHADER_API_DESKTOP Windows, Mac and Linux desktop platforms, Web
SHADER_API_MOBILE iOS and Android mobile platforms, tvOS

Additionally, SHADER_TARGET_GLSL is defined when the target shading language is GLSL (always true for OpenGL/GLES platforms).

Additional resources


Did you find this page useful? Please give it a rating:

  • Branch in a shader via built-in macros
    Branch based on shader model