hello,
recently I started to develop something that will involve quite many outputs, but that’s just background… The real problem is however tightly connected.
I wanted to see, how much variables I can output from vertex shader, so I set up transform feedback and started to create arrays like this.
flat out unsigned int numN[11]
and substitued N for 1, 2, 3… I’m using Nvidia 540M, and GLSL outputs error if I exceed N=11 - not enough space to initialize. That’s fine, because I’m notified about that. But there’s something else - it looks like memory gets corrupted if I use more than 32 integers, that means N>=3. I’ll post here some results of transform feedback for various N.
N = 2
1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2
N = 3
1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 1
N = 11
1 1 1 1 1 1 1 1 1 1 1 4 7 10 2 2 2 2 2 2 2 2 5 8 11 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 4 7 10 2 2 2 2 2 2 2 2 5 8 11 3
3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 4 7 10 2 2 2 2 2 2 2 2 5 8 11 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 4 7 10 2 2 2 2 2 2 2
2 5 8 11
The tokens that goes into transform feedback setup are as following
num1[0], num1[1], ...,num1[10], num2[1], ..., num11[10]
(well this is for last case… N=2 uses num1 and num2 only, etc.). In shader, values of numN at each index of array are set to N
num1[0] = 1, num1[1]=1, ..., num2[0]=2, ...
As you can see in N=3, there should be 3 not 1 as last number. As this is the 33th number, it really looks like I can transform feedback only up to 32 integers (as N=2 has no problems and N=11 is total mess). This, however, should result in error not a memory corruption, because if I wouldn’t first test it, I would have headache by now.
Can anyone explain? Is there something like MAX_TRANSFORM_FEEDBACK_VARYINGS and is it even related to transform feedback or is it problem of GLSL in first place.
Thanks