Skip to main content
gamedev.net
🔒 Locked

Array indexing in shader

Started by smitty1276 Mar 29, 2006 at 10:55 PM 0 replies 2k views
Original Post
smitty1276
smitty1276
Hey guys, I'm trying to access an array of 11 structures in a fragment shader, in a for loop from i=0 to 10 (I literally specified the upperbound). Now, it won't compile, and keeps saying "error C5043: profile requires index expression to be compile-time constant". How can i not be a compile time constant? Does anyone know what might be my problem? For what it's worth, I'm using GLSL, and the array of structures is a member of a structure and its size is explicitly stated in the declaration. Thanks in advance.
smitty1276
smitty1276
Hmm... I had a break statement in the loop, and it didn't like that. I replaced it with a lot of flag checks to achieve the very same conditional execution, and it compiles now.

Bizarre. I guess the compilers aren't all that smart. lol

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.