PDA

View Full Version : Quick question about GL_MAX_VERTEX_UNIFORM_VECTORS.



DigitalSynapses
01-21-2012, 11:02 AM
In OpenGL I can access the number of supported vertex shader uniforms by requesting "GL_MAX_VERTEX_UNIFORM_COMPONENTS" which will let me know how many "float" values can be assigned. This works with any any combination of float, vec2, vec3, etc.

However in OpenGL ES I can only access the number of supported vertex shader uniform vectors by requesting "GL_MAX_VERTEX_UNIFORM_VECTORS" which will let me know how many "vec4" values can be assigned.

My question is simple. If I set a uniform using "glUniform1f" or "glUniform2f", etc, does it expand to fill an entire "vec4" worth of space on the GPU, or are those values packed in memory to only fill the required space? Or heaven forbid is it vendor specific?

I just need to figure out if I need to "prepack" my uniforms before sending them to the GPU. Thanks!

Xmas
01-23-2012, 08:02 AM
Whether they are actually packed is implementation specific (but also completely invisible to the application). However there is a packing rule (described in appendix A.7 of the GLSL ES spec) which describes how uniform variables should be counted against the implementation limit.