Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: invalid swizzle for scalar op

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    2

    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:

    Code :
    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

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jan 2001
    Location
    NVIDIA, Austin, TX
    Posts
    555

    Re: invalid swizzle for scalar op

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

    POW scalar.x, scalar.x;

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    2

    Re: invalid swizzle for scalar op

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •