3 ms·
SPIR-V is an intermediate bytecode format. That bytecode is the data that you use in the Vulkan API, and under the hood your graphics drivers compile that bytec
by pharrington 3y ago
SPIR-V is an intermediate bytecode format. That bytecode is the data that you use in the Vulkan API, and under the hood your graphics drivers compile that bytecode into the device-specific native shader binary that runs on the graphics hardware.
Vulkan doesn't come with any tools to generate that bytecode though. Foreign shader language (like HLSL, GLSL, etc) to SPIR-V compilers exist, and various graphics toolchains can generate SPIR-V. https://github.com/KhronosGroup/SPIRV-Tools https://github.com/KhronosGroup/SPIRV-Tools does have tools to validate and optimize bytecode.
edit: i lied apparently - the SPIRV-Tools does have an assembler that translates text such as the "Corresponding SPIR-V" at https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_example https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.htm... to bytecode. However, that's not something you'd want to write manually, especially if you're used to something like GLSL.