[SOLVED] Cg Error: profile does not support "for" statements

Hey everyone,

If in a shader I have a fragment program that has a for loop in it such as:

... int number_of_runs = 5; for(int i; i < number_of_runs; i++) { ... } ...

I get this as an error:

C5013: profile does not support "for" stantements and "for" could not be unrolled.

If however I change the loop to:

... for(int i; i < 5; i++) { ... } ...

the shader compiles. Is this an issue with Shaderlab not supporting dynamic for loops or is it something to do with my graphics card (dual 8800GTX) or something else entirely?

Thanks in advance, Ryan

Note: Heavily edited because I wasn't really asking what I meant to ask in the original post.

Try using a higher shader profile


#pragma target 3.0

documented here: