Game Development Community

[RESOLVED kinda] edgeDetectP.hlsl warning X3550

by Steve Acaster · in Torque 3D Professional · 08/12/2009 (11:08 am) · 10 replies

From stock New Project.

game/shaders/common/postFx/edgeaa/edgeDetectP.hlsl(30,13): warning X3550: array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll

Not sure about this warnign, AA seems to work fine. Shaders ain't my strong point ...


#1
08/12/2009 (11:13 am)
I'll take a look when I get home if nobody else has done it.

If you are feeling intrepid you could open the shader file in notepad++ and see what's on line 30.
#2
08/12/2009 (11:14 am)
This warning is telling you that shader code, which would otherwise be a dynamic loop, is being unrolled.

So, this means that, instead of something like this:
for(int i = 0; i < 4; i++)
   foo[i] += bar;

Turns into...
foo[0] += bar;
foo[1] += bar;
foo[2] += bar;
foo[3] += bar;

And the compiler is just warning you about why this is happening.
#3
08/12/2009 (11:24 am)
@Joshua - actually I did have a peek, and it seems to be exactly the same file as in Beta4, which didn't flag a warning, so I reckoned it was because of something else.
#4
08/12/2009 (12:01 pm)
Oh.. yeah I haven't seen that file. Loop unrolling is usually an optimization but I guess it's saying it can't address the memory at run-time. I'll be interested to look at this file to see how that array is being passed to the shader.

#5
08/12/2009 (2:00 pm)
Yea... whenever you use array indexing via [] in a loop it spits out that warning. Its sort of annoying... not sure if there is a way to code it better or disable that one warning in that case.
#6
08/12/2009 (6:03 pm)
@Steve:
I recall seeing this warning before - might have been a Beta other than 4 though - can't remember.

@Tom:
I wonder if there is a difference about how the two blocks would count against the maximum command count for the actual shader model. If there's no difference, then I think the warning should be suppressed.
#7
08/12/2009 (6:06 pm)
There is a difference. Unrolling the loop means it will duplicate the instructions.
#8
08/12/2009 (7:16 pm)
@Konrad - Here's where I've seen it before - when I was getting the cartoon Outlining shader to work. linky And you did do a resource along those lines.
#9
08/13/2009 (4:24 am)
@Steve: You're right, that's why it was familiar. :)

@Pat: Thank you for the info! That's very useful to know!
#10
09/30/2009 (10:57 pm)
Just on a clean up.
Not resolved in Release, but not really a bug - see post 5 - so moved to resolved.