- Home /
[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.
Not sure if this is relevant but I just mucked with the render emulation and when I set it back to No Emulation I get a console error saying no subshaders can be run on this graphics card.
Answer by Mike 3 · May 22, 2010 at 10:48 PM
Try using a higher shader profile
e.g.
#pragma target 3.0
documented here:
http://unity3d.com/support/documentation/Components/SL-ShaderPrograms.html#target
that got rid of error C5013, now it's telling me I need a vertex program too. I think I need to spend more time reading the docs.
Aren't 8800's S$$anonymous$$3 cards though?
Gah, missed the part where it says they get compiled into 1.1 by default. Thanks $$anonymous$$ike!
Your answer
Follow this Question
Related Questions
Shader to ignore post processing effects 0 Answers
Profile does not support "for" statements and "for" could not be unrolled. 1 Answer
Building a Custom Shader 1 Answer
Please help me resolve these errors related to shaders. 0 Answers
How to Get Nice Thick Toon-Like Outlines On Non-Smooth Geometry? 1 Answer