I'm using Jonno Robson's Vulkan code base from github found here: Vulkan-Terrain-Generator as a guide and or learning reference to better understand Vulkan. I don't have any issues with the source code itself, but my question or concern pertains to compiling GLSL shader codes into Spir V code. I am new to SpirV its compilers and tool kits. I've tried using both: glslangValidator.exe and glslc.exe to convert the shader files into Spir V files.
In Jonno's code base, he converted each GLSL shader file into a corresponding spirv file. I tried using the flag options that he used in his batch file the only difference is I replaced the directory that points to his glslangValidator.exe with my own directory.
I'm trying to achieve the same effect where it will take all of the shader files that are in the directory of the batch file to be compiled from GLSL to Spir V where it will append .spv
to the end of each of the new SpirV files that it will generate in that directory after converting it from GLSL to the respected Spir V byte code.
Here is what my batch file looks like:
compile.bat
C:\VulkanSDK\Bin\glslangValidator.exe -V %1 -o %1.spv
pause
However it is not working for me after I double click on the batch file. It opens and runs, but it is not generating the expected shader_filename.vert.spv
... shader_filename.frag.spv
files.
I don't know what platform they did theirs on, but I'm running Windows 7 and I don't know if that makes a difference with the command arguments or flags to be fed within the batch commands. I don't know if they used any other tool kit within the Vulkan SDK or some outside library or tool or what not.
What I would like to be able to do with this batch file is to convert all of the shader files into the appropriate Spir V files with the simplest batch command there is. I don't want to have to write the same command over and over again for each shader file as there are over 20 shaders in this directory.
How can I achieve this or what are the proper command arguments for either glslangValidator or glslc to generate the needed SpirV files?
I have read the documents found here: SPIR-V Toolchain but I'm still not sure how to properly generate the needed batch file.