I’m curious if anyone has experience with precompiling GLSL to SPIR-V, and then feeding in those SPIR-V shader modules to OpenGL drivers for one or more GPU vendors.
- what GLSL-to-SPIR-V precompiler did you use (e.g. glslang),
- did you run into any problems with precompiling (unsupported GLSL features/extensions/etc.),
- what GPU vendors’ GL drivers have you tried this with,
- did you notice much of a performance hit with glShaderBinary() or glSpecializeShader() (in OpenGL 4.6; see ARB_gl_spirv and ARB_get_program_binary).
- any other advice you could give to others based on your experience?
I’m actually wondering whether this might be a reasonable path to help avoid some of first-time GLSL shader compilation cost associated with feeding GLSL source code to GL drivers at runtime, but yet provide some measure of cross-platform/-GPU/-driver-version support for the precompiled “binaries” fed into the GLSL driver. I’m also curious whether this path might bypass some/all of the cost of dynamic shader reoptimization (aka shader patching) that sometimes occurs at runtime when you’re rendering, which is extremely bad for users of high-performance OpenGL applications.
(Looks like Sascha Williams has played with this a bit (LINK), but I didn’t see much else out there.)