4

I am using the ARB_debug_output extension. The driver gives me this warning:

Program/shader state performance warning: Vertex shader in program 16 is being recompiled based on GL state.

So, I tried setting various GL state before I compile my shader, including:

  • GL_BLEND
  • GL_CULL_FACE
  • GL_DEPTH_TEST
  • polygon-offset
  • blendfunc

...but it still recompiles upon first draw.

What are the typical pieces of state that could cause the driver to recompile a vertex shader?

4
  • "But it still recompiles upon first draw." What do you mean "upon first draw"? Is it the first time you're rendering with that shader at all? "I tried setting various GL state before I compile my shader" No shader compiler/linker is going to assume that the OpenGL state at the time of compilation/linking accurately reflects the OpenGL state that will be present at the time of use. So it really doesn't matter. Aug 12, 2019 at 2:57
  • Yes, at first render. I want to avoid a re-compile at that time. And I expect the driver to not recompile if state at compile-time is the same as the state at render-time.
    – Bram
    Aug 12, 2019 at 4:16
  • 1
    "I expect the driver to not recompile if state at compile-time is the same as the state at render-time." You shouldn't expect that. Driver writers certainly don't expect it, so neither should you. Aug 12, 2019 at 5:38
  • 1
    @NicolBolas Those same 'driver writers' also put in the performance warning, though. If the re-compile could not be avoided, the warning makes no sense.
    – Bram
    Aug 12, 2019 at 19:14

1 Answer 1

3

I've run across this problem recently. It occurred that unbinding Vertex Array Objects caused this warning to appear. After deleting the lines with glBindVertexArray(0) the warning message disappeared.

1
  • Why does this fix the error? I encountered it after refactoring my shader code according to the Cherno's tutorials. The error is fired from the debug message callback system from OpenGL 4.3. Furthermore, the error also disappears if you call glUseProgram(0) before drawing so you don't need to delete the line with glBindVertexArray(0).
    – Tom
    Jun 17, 2021 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.