View Full Version : Array layout in uniform block?

05-12-2011, 06:14 AM

I have a question regarding uniform buffer objects with an array of integers. I have the following block using shared layout:

uniform FooBar
int test[1024];

I'm loading up 1024 integers into this uniform block and it works *most of the time*.
Sometimes however, it just seems the data I get from the uniform block, from my shader code, is wrong.
This word, "sometimes", suggests that my code is incorrect ;)

I decided to alter the block definition and change it to:

layout(std140) uniform FooBar
int test[1024];

but in this case it doesn't work at all. Why?

How can I set up the uniform block so that I can access a regular, ordered, integer array in my shader code?

(Nvidia Fermi, recent drivers)