PyShaderc: Compile to Spir-V like a boss
Like you know, Vulkan needs to be fed with Spir-V shaders. To do so, you will write your shader in glsl and you will use shaderc or glslang to compile your Glsl code into Spir-V (shaderc uses glslang internally).
Currently, you must use the command line or C/C++ code to compile your shaders.
PyShaderc is a wrapper around shaderc (using cffi internally) that gives you the ability to compile your shader to Spir-V in only one line of Python!
Let’s take a look
pip install pyshaderc
import pyshaderc spirv = pyshaderc.compile_file_into_spirv('/tmp/myshader.vs.glsl', 'vert')
spirv contains your Spir-V code! Another module to add into vulk. This allows you to work only with Glsl code, like with OpenGL.
More informations on Github: PyShaderc
Let me know what you think of this article on twitter @realitix!