I'm developing application with open GL / ES for desktop/mobile (android/iOS) platform.
And I'm using const arrays in my vertex shader code. I test it on my nv8800GT with and without const arrays and saw no difference. But I read, that const arrays could be MUCH slower than uniforms.
const float offset_s[4] = float[4](0.625, 0.625, 0.75, 0.85);
The question is - should I avoid const array in uniform favor? Or everytrhing ok now? Drivers fixed and so on...
const vec4 pos [4] = vec4 [] ( ... )
becomes a uniform namedvec4 _main_pos_0[0]
, with size=4. Because it is used in the function:main (...)
. – Andon M. Colemanuniform
variable forconst
qualified variables at global scope. It probably is better to use uniforms instead of global const arrays to ensure consistent behavior across all implementations. Also, that limitation you mentioned only applies to the vertex shader stage - you can do this sort of thing in any stage. Each one will have its own different limitation. – Andon M. Coleman