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 5 of 5

Thread: Fragment Shader not compiling on NVidia (it does on ATI)

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    14

    Fragment Shader not compiling on NVidia (it does on ATI)

    Hi all,

    A short description of my problem. I have a terrain generator which uses a certain vertex and fragment shader. It works completely as expected on my system, and that of 2 others with an ATI graphics card.
    However, for another person with an NVidia card, the fragment shader fails at compilation (I have debugged my code and determined the compilation is really failing). However, without access to an NVidia card myself, I'm having a hard time figuring out what in the world could be wrong. I was hoping someone with NVidia experience could have a look at my shader code, and see if he/she can spot something "fishy". I will also present the vertex shader for completeness.

    (As this is my first post, for some reason it isn't letting me post the shaders, even though they don't contain URLs or bad words, so here's a link to an online notepad: shrib.com/ekQlUonP)

    I thank anyone in advance for having a look!
    Lodeman

  2. #2
    Member Regular Contributor malexander's Avatar
    Join Date
    Aug 2009
    Location
    Ontario
    Posts
    315
    Code :
    0(62) : error C7505: OpenGL does not allow swizzles on scalar expressions

    is the error it's generating. It does not like "texCoord1.s", as texCoord1 is declared as a float.

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,194
    Quote Originally Posted by Lodeman View Post
    ...NVidia card, the fragment shader fails at compilation ... However, without access to an NVidia card myself, I'm having a hard time figuring out what in the world could be wrong. I was hoping someone with NVidia experience could have a look at my shader code, and see if he/she can spot something "fishy".
    You can download the Cg distribution (Cg Toolkit Download link), and then compile the shaders using:

    Code :
    > cgc -oglsl -strict -glslWerror -nocode -profile gp5vp t.vert
    > cgc -oglsl -strict -glslWerror -nocode -profile gp5fp t.frag

    If you do so, you'll see this fragment shader error:

    Code :
    t.frag(63) : error C7505: OpenGL does not allow swizzles on scalar expressions

    on this line:

    Code glsl:
      vec4 fragColor = color * texture(texture0, texCoord0.st) * texture(texture1, texCoord1.s);

    It's complaining about texCoord1, which is a float (scalar expression).

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    14
    Thank you very much for your assistance, I shall try this tonight and let you know the outcome.
    The Cg Toolkit sounds like it's exactly what I need!

    Cheers.

  5. #5
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    14
    Update: fixing the swizzlin' worked like a charm! My NVidia friend can succesfully compile and run the shader :-)
    Thanks again!

Posting Permissions

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