Search code examples
shadervulkan

Compiling shaders in Vulcan, "Create a compile.bat file?" Windows 10 Visual Studio


Hi I was following this Vulkan tutorial and I just don't know what they mean by

Create a compile.bat file with the following contents:

C:/VulkanSDK/x.x.x.x/Bin32/glslc.exe shader.vert -o vert.spv
C:/VulkanSDK/x.x.x.x/Bin32/glslc.exe shader.frag -o frag.spv
pause

This is in the link under "Compiling the Shaders."

What is a compile.bat file? Where do I create it? I tried entering in these commands but with the appropriate version and it just says it can't find shader.frag or shader.vert, which I created in my project just as the tutorial instructed. I'm using Visual Studio on Windows 10.

I think it is assuming some command line savviness with this tutorial which I do not have lol I know basic stuff like mkdir and cd but that is pretty much it. And it looks like the .spv files have to go into the shaders directory in my project but those commands don't refer to that directory. And later, you just read the bytes from vert.spv and frag.spv like readFile("shaders/vert.spv") so what is the compile.bat file even for? Thank you.


Solution

  • @krOoze helped me in the comments: you create the compile.bat in the shaders folder, put the commands in the compile.bat file. Then, open your project in file explorer and double-click on the .bat file to run it.