Search code examples
openglglslglewopengl-extensions

GLEW and my shader disagree - do I have that extension or not?


I'm discovering shaders by use, and have come to a weird issue.

I need the ARB_robustness extension for my fragment shader to function properly. GLEW is positive that I have that extension :

assert(GLEW_ARB_robustness); // Passes

...however when I require it in my shader...

#extension GL_ARB_robustness : require

...the shader compiler does not recognize it.

0(3) : error C0202: extension ARB_robustness not supported

GLEW is correctly initialized, and everything works fine as long as I don't try to use that extension.

What could be the cause of this problem, and how could I solve it ? Thanks in advance.

Update: I'm poking at it on my side with the help of a friend, I ran glxinfo on his advice and the name of the extension does appear in the output.


Solution

  • GL_ARB_robustness is not a GLSL modifying extension. The intention of this extension is to make the interaction with the OpenGL API more robust in the sense that out-of-bound accesses to memory can be caught. Somewhat like the difference between sprintf and snprintf. Since this is not a shader extension it makes no sense to declare using it in the shaders.

    EDIT Apart from that to actually have robustness support, the OpenGL context must be created with the robustness attribute enabled: See https://www.opengl.org/registry/specs/ARB/wgl_create_context_robustness.txt and https://www.opengl.org/registry/specs/ARB/glx_create_context_robustness.txt – with robustness actually enabled for the context, the shader may also pass.