Instead of manually compiling my GLSL shaders on SPIR-V, I want Visual Studio to automatically detect changes in the shader files and run glslangValidator as a build step. I am using Premake to create a Visual Studio solution / project.
One of the partially worked out solutions was announced in premake5.lua:
--prebuildcommands [[for %%i in (..\data\shaders\*) do (..\libs\vulkan\glslangValidator.exe -V -o "%%~dpibin\%%~nxi.spv" %%i)]]
and then right-click shader in solution explorer -> properties -> General -> Item Type -> Custom Build Tool.
There are some disadvantages to this approach:
- All shaders are recompiled when only one changes
- I had to manually change the settings of the VS project
The closest thing I could find in the documentation was the following: Custom build commands . I think the idea is to use a filter for shader files and generate build commands, but I just couldn't get anything to work. Maybe someone has an idea?
source
share