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: Fastest Online Notepad with Privacy and Publishing)

I thank anyone in advance for having a look!
Lodeman

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.

You can download the Cg distribution (Cg Toolkit Download link), and then compile the shaders using:


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


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

on this line:


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

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

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.

Update: fixing the swizzlin’ worked like a charm! My NVidia friend can succesfully compile and run the shader :slight_smile:
Thanks again!

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