AI-generated Key Takeaways
-
This guide explains how to generate Vulkan C++ headers for different operating systems from shader files.
-
The process involves downloading and using the Khronos Group Glslang Tool.
-
You will need to locate the shader files within the Cardboard repository.
-
Commands are provided for Windows, macOS, and Linux to generate the required header files.
-
The output of the process should be
distortion_frag.spv.handdistortion_vert.spv.h.
This guide shows you how to generate the Vulkan C++ headers for each host OS from the shader files.
Generate C++ headers from the shader files
Download the Khronos Group Glslang Tool: Candidate of July 26, 2020 on your local machine.
Unzip it.
Check its version:
Windows
bin\glslangValidator --version
macOS
./bin/glslangValidator --version
Linux
./bin/glslangValidator --version
In the Cardboard repository, locate the
sdk/rendering/android/shadersfolder and save its path.Generate the Vulkan header files in C++:
Windows
bin\glslangValidator -V --vn distortion_frag %SHADERS_FOLDER_PATH%\distortion.frag -o distortion_frag.spv.hbin\glslangValidator -V --vn distortion_vert %SHADERS_FOLDER_PATH%\distortion.vert -o distortion_vert.spv.hmacOS
./bin/glslangValidator -V --vn distortion_frag $SHADERS_FOLDER_PATH/distortion.frag -o distortion_frag.spv.h./bin/glslangValidator -V --vn distortion_vert $SHADERS_FOLDER_PATH/distortion.vert -o distortion_vert.spv.hLinux
./bin/glslangValidator -V --vn distortion_frag $SHADERS_FOLDER_PATH/distortion.frag -o distortion_frag.spv.h./bin/glslangValidator -V --vn distortion_vert $SHADERS_FOLDER_PATH/distortion.vert -o distortion_vert.spv.h
You should now have distortion_frag.spv.h and distortion_vert.spv.h.