Error C5025: lvalue in assignment too complex

I’m struggling with this error occuring in assignment array indices. Internet has given few different solutions that didn’t really work.

Error’s name would suggest that the expression in index braces is too complex, but I doubt it is in this line:

outFrag.LightDir_tan[i] = normalize(lightDir);

As i experimented around the array itself, I noticed this error sometimes depends on array’s size, but not in this case. It occurs either when the array size is 30 or when it’s 3.
The error however disappears when I write a number instead of “i”, but entering all of the manually isn’t a case.
I’ve readen that there is a pragma that would make the loop to be manually manually executed “i” times in the code, but I don’t think that is an elegant solution.
Variable “i”, that is used to index the LightDir_tan is simply incremented in for loop.

I’d like to know what causes this error and how to fix it.
I’m using Windows 8 and NVidia GeForce GT 720M graphics card, if that matters.

It might not be possible in your case:

[…] Under GLSL version 3.30, sampler arrays […] can be declared, but they can only be accessed by compile-time integral constant expressions. So you cannot loop over an array of samplers.

Under GLSL 4.00 and above, arrays of opaque can be accessed by non-compile-time constants, but there are still limitations.

Source: click me

I’m using version 4.30 and the array is just an array of vec3s, not a sampler array.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.