Reputation: 5255
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...
Upvotes: 2
Views: 1985
Reputation: 1796
I am experiencing weird behaviour with const and non-const arrays in GLSL.
Changing const arrays to non-const arrays provided a small speedup in some shaders. On the other hand, removing the "const" keyword in other shaders resulted in a massive performance drop (from ~2ms down to ~20ms for the render pass). The behaviour seems to be very inconsisent and my guess is that it's a driver bug.
My GPU is an Nvidia GTX 460 and I'm using the driver version 358.50 (similar behaviour observed with an older driver).
Upvotes: 1