Can uniform blocks get removed by GLSL compiler?


is it legal for the GLSL compiler to optimze away a whole uniform block (layout std140 !) given that no uniform from it is used? I know, that the layout itself is well defined by the specs and a single uniform in it can not get ‘optimized away’ (that’s what layout packed is for). However, if none of the uniforms are used / no uniform is active, can the uniform block become inactive?

This seems to happen on MacOS X, but on the other hand, the uniform buffer implementation there (and OpenGL/GLSL in general) is quite buggy (I filed 2 bugreports today alone…) so I woudn’t be surprised if that behavior is not ok. But couldn’t find a definitive clue in the specs.

Any idea?

Search for “active” in the spec:

"Like uniforms, uniform blocks can be active or inactive. Active uniform blocks are those that containactive uniforms after a program has been compiled and linked. "

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