Invalid swizzle for scalar op

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

The POW function takes scalar operands not vector operands. You probably need to do something like this:

POW scalar.x, scalar.x;

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

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.