GL_ARB_gl_spirv (specifically reload)

Hello,

I am able to create SPIR-V shaders that I can apply to our application. I use the glslang compiler that will generate SPIR-V calling GlslangToSpv(...). I have converted several test GLSL shaders and have been successful using them in place of the original GLSL shaders.

Currently, during development with our GLSL shaders, we are able to reload, recompile and relink the shaders when they are modified during run-time. Modifying gl_Pointsize in a vertex shader, as a simple example, will immediately show the change to the rendered scene.

I am trying to get this to work with the binary SPIR-V data. If a GLSL shader is modified, it is reloaded, re-parsed and regenerated to SPIR-V (calling GlslangToSpv). The data is then reloaded with glShaderBinary. Afterward, glSpecializeShader is called. It’s at this point I get an INVALID_OPERATION.

According to the spec:
Once specialized, a shader may not be specialized again without first re-associating the original SPIR-V module with it, through ShaderBinary.

That’s a little vague to me and I was hoping that perhaps maybe someone here has had experience with this and can point me in the right direction.

I am going through ShaderBinary again with the new binary data. I understand that SPIRV shaders are exported as binary with releases, but during development, it makes it exponentially easier to debug with reloading.

Thanks,
DC

It would probably be best for all involved if you just didn’t use that same shader object again. For most people, shader objects are ephemeral, so I would wager that implementations could break when people start reusing them.

Just create a new shader object; it’s not going to hurt anything.

That option works. Thank for the help!

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