What tool should I use to convert compiled Vulkan SPIR-V bytecode into C/C++ header files?

Hi There,
I just started using PowerVR SDK for my Vulkan study. When I study on the first sample project “VulkanHelloAPI”, I noticed that the project contains two compiled SPIR-V shader bytecode in C/C++ header format: fragShader_bin.h and vertShader_bin.h.
Obviously these two binary shaders are compiled by the corresponding shader source code VertShader_vk.vsh and FragShader_vk.fsh.

I understand that I should use external tool “glslangValidator.exe” to compile the GLSL into SPIR-V bytecode. But my question is which tool I should use to convert the generated bytecode into the C/C++ header files so that we can include them in our C/C++ source code?

Forgive me if this is a simple question, I have spent a some time to try to get the answer in the document.

Hi Peter,

I believe you can simply write one that reads a spirv file and converts it into a binary header.


Hi Marton,
Thanks, this is what I did for converting compiled HLSL shader bytecode.
I was Just wondering there might be a piece of code / tool in the SDK bundle to do this so that I can save some time.