PDA

View Full Version : invalid swizzle for scalar op



bytemixer
01-10-2004, 10:34 AM
I am trying to move my shader code from OSX 10.2 to 10.3 and I am getting new shader compiler errors. The error might be platform specific but then again I might have been doing something boneheaded which the old compiler did not catch.

The exact error I am getting is:
"invalid swizzle for scalar op (hint: 'specular')"

The code being referred in the error to is:




TEMP specular, lightVec1, normal, ...;
...
# high power specular
MOV specular, lightVec1;
DP3 specular, normal, specular;
POW specular, specular, 1000; # ERROR HERE

# the same error also applies to:
POW specular, specular, 1000.0;


There is some problem with the POW instruction and it seems to be related to the operands. I tried replacing the inline constant with a constant variable but got the same error. What's wierd is that the compiler is complaining about a scalar op but there is no scalar type declaration, only floating point temporary variables TEMP (to my knowledge).

Commenting out the line with the POW instruction eliminates the error. I get similar errors for the RSQ and RCP instructions.

Any help would be greatly appreciated.

-e

jra101
01-10-2004, 10:47 AM
The POW function takes scalar operands not vector operands. You probably need to do something like this:

POW scalar.x, scalar.x;

bytemixer
01-18-2004, 05:57 AM
You are right. It appears a 'scalar' operation only applies to a single component of a vector. Thus,

POW specular.x, specular.x, 1000.0;

works like a charm. Thanks for the help.

-e