Question

From what I've read of the invariant keyword for GLSL ES 2.0, it sounds kind of like something which could be considered synonymous with the functionality provided by a uniform buffer object, in the sense that multiple shader programs can "share" the data provided for various inputs. What I'd like to know is whether or not this could be used as an alternative for a UBO in any way. Since OpenGL ES 2.0 appears to not provide support for UBOs, and if the invariant keyword can't act as an alternative, is it possible to obtain similar functionality, using extensions or otherwise?

Was it helpful?

Solution

invariant has absolutely nothing to do with uniform buffers. invariant means that if two separate shaders have the same input values and use the same expression to compute the invariant-qualified output, then the output will be guaranteed to produce the same value in both shaders. Without that qualifier, such a guarantee does not exist.

invariant has nothing to do will sharing "the data provided for various inputs". invariant is about how the output is qualified and computed.

As for the rest of your question, no, OpenGL ES 2.0 has nothing similar to UBOs. You'll have to set different uniforms on different programs to the same value.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top