GLSL -> SPIR-V -> OpenGL

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.

If so…:

  1. what GLSL-to-SPIR-V precompiler did you use (e.g. glslang),
  2. did you run into any problems with precompiling (unsupported GLSL features/extensions/etc.),
  3. what GPU vendors’ GL drivers have you tried this with,
  4. 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).
  5. 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.)

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.