Shaders

Shader languages

This folder contains the textual shaders for the samples. All samples come with GLSL shaders and some optionally with Slang and HLSL shaders. For samples that support multiple shader languages, this is a good way to compare the syntax differences when targeting SPIR-V for Vulkan.

Compiling shaders

The samples load offline compiled SPIR-V variants of the GLSL/Slang/HLSL shaders. If you have the appropriate compiler installed, e.g. via the LunarG VUlkan SDK, shaders will be automatically compiled when building the samples project.

Note for compiling Slang shaders: The minimum required version of the Slang compiler is 2025.16.1. Older versions might have issues compiling shaders or may result in invalid SPIR-V. It’s advised to use the latest version from here.

Selecting shading language

To select a shading language, use the --shading-language argument followed by the shading language glsl, slang or hlsl. Samples default to glsl.

Further information

The Vulkan Guide contains further information on how to use HLSL with Vulkan and how it compares to GLSL: