View Full Version : Limits of GLSL Arrays

05-04-2011, 12:12 PM
In an earlier question, I asked about how to move more processing into the GPU.

I think that may have been too vague, so lets just ask:
- How large an array can I build in the shader? Is there a gl query function?
- Can I index into the array with a variable rather than constant? The GLSL reference is a bit vague.
- Ditto for a for(init, condx, incr) loop. Can the condx be i<variable rather than i<const?


-- Owen

05-07-2011, 09:28 AM
The answer is it's implementation dependent.

However, the usual trick is to pack large arrays into textures - which gives you a practical limit up in the millions. You can generally rely on having 2048x2048 by four (RGBA).