Usage: SPIRVReplace.exe [input-file] [entrypoint]
Command line batch file program written in C# for compiling single stage GLSL shader files into SPIRV bytecode and then updating the entrypoint with SPIRV bytecode from "main" to [entrypoint].
All output files will be new SPIRV bytecode file ending with *.spv.
For example:
> SPIRVReplace.exe sample.frag frag_func
>>
>> Output file: sample.frag.spv
Later on, you would supply "frag_func" as the stage's pName into Vulkan's VkPipelineShaderStageCreateInfo when create a new pipeline.
typedef struct VkPipelineShaderStageCreateInfo {
VkStructureType sType;
const void* pNext;
VkPipelineShaderStageCreateFlags flags;
VkShaderStageFlagBits stage;
VkShaderModule module;
const char* pName;
const VkSpecializationInfo* pSpecializationInfo;
} VkPipelineShaderStageCreateInfo;
- Compile GLSL code into SPIRV bytecode via glslangValidator.exe
- Disassembly SPIRV bytecode into AST representation via SPIRV-dis.exe
- Perform search-and-replace on AST to change "main" to "[entrypoint]" (i.e. in quotes)
- Reassembly SPIRV bytecode from AST representation via SPIRV-as.exe
Run Visual Studio solution in SPIRVReplace folder
- Copyright (c) 2016 David Young under MIT License
- Source code for glslangValidator.exe, SPIRV-dis.exe, SPIRV-as.exe. LICENSE included.
Windows assemblies
Found in Bin/Bin32 folders of the WINDOWS version of LunarG Vulkan SDK v1.0.30
Found in Bin/Bin32 folders of the WINDOWS version of LunarG Vulkan SDK v1.0.30
Found in Bin/Bin32 folders of the WINDOWS version of LunarG Vulkan SDK v1.0.30
Try modifying the .config found in the Bin folder to use linux version of these assemblies