When compiling the following for loop in my HLSL shader under Shader Model 2.0, I'm getting Error X3511.
for (int x = -5; x <= 5; x++)
{
for (int y = -5; y <= 5; y++)
{
...
The error reads as follows: unable to unroll loop, loop does not appear to terminate in a timely manner (5 iterations), use the [unroll(n)] attribute to force an exact higher number.
I'm aware of this error message, but I'm not using a variable here for the conditional part of the for statement - it's a hardcoded x <= 5 condition. What is wrong here?
Thanks in advance!
Try this:
[unroll(121)] for (int i=0; i<121; i++)
{
int x = i / (int)11 - 5;
int y = i % (int)11 - 5;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With