GLSL uniform array length

BlitzMax Forums/OpenGL Module/GLSL uniform array length

beanage(Posted 2009) [#1]
I would like to thank all people in this forum who keep answering my weird questions about opengl. Let me aussure you, it's worth it! So thats, said, one last:

Are there drivers objecting me to uniform object arrays in dimensions of 1M elements?
( maybe some only allow unsigned shorts for indexing or so ).. who can tell.

[ Edit: Just anyhow got the feeling I'm playing with fire working with above 1k elements in any collection anyway ]

ty


JoshK(Posted 2009) [#2]
There is no reliable way to determine the maximum size of a uniform array. My testing has revealed a maximum of 59 elements for an array of mat4s on SM3 hardware. The GEForce 6200 allowed 59, and the ATI X1350 allowed 60.

Look at uniform buffers or float textures if you need to send a large set of random-access data to the GPU.


beanage(Posted 2009) [#3]
Mmmmh.. I actually wanted to use a 'legal' way to get the data to the shader ( its primarily that i want to fetch parts of the scene graph to the shader making the quantity ).

Ok, so the next idea is to copy the informations into a texture.. That will increase tex lookups by integral times, but I gave up saving tex lookups ages ago anyway .. however, it would be interesting to know how it effects the shader performance. What are your experiments telling about this?

[ Edit: Texture Buffers. That smells perfect. Ok, it's GL3.1 but I don't care anymore. Those seem to be right the 'legal way' I've been searching for. Are there things I need to consider working with them? ]


JoshK(Posted 2009) [#4]
In OpenGL 2.1, I found float textures to be slower than uniform buffers on the CPU side, but faster overall.


beanage(Posted 2009) [#5]
Can I read integers out of a float texture?