What nvidia gfx card do you have? From the error message it looks like it’s an older card which does not support what you are trying to achive and therefore you get the error message.
This calls for a texture lookup.
Put the data you want to index into a texture (1D in your case) and calculate the lookup s-coordinate instead of an array index.
There is also no need for expensive ifs if you use the HW alpha test and encode the discard condition into the texture.
Yeah, this is the workaround I thought too, but I still think that this code is correct so this should be a compiler/language bug.
I don’t really need that if, I used it just to have a “visual debug”, however could you tell me more (or give me some reference) about encoding the discard condition into the texture?
The error message explained the problem pretty well. The only indexable data in a fragment shader on that generation hardware is the interpolators. At best you’d get software rendering.