A very strange bug(really a bug? ) of NVIDIA's GLSL implemention

I find a very interesting thing about nvidia’s glsl implemention.

VS: file name (Simple1.vs)
content: (copyed from RenderMonkey)

varying vec2 Texcoord;

void main( void )
{
gl_Position = ftransform();
gl_FrontColor = gl_Color;
Texcoord = gl_MultiTexCoord0.xy;
}

PS: file name (wavespread.ps)
Content: (write myself to calculate the water wave.

uniform sampler2D Texture0;
uniform vec4 pixel_dim;
uniform float fFrameTime;
varying vec2 texCoord;

void main(void)
{

}

obviously . if you link these two shaders . driver should throw a error.
but in fact ,NVidia’s driver dose not .

In my notebook . GPU is NV7400Go . Driver is 84.26, those two shader worked very well.

In my PC , GPU is NV6600 , Driver is 84.xx, those two shader worked well too … :frowning:
upgrade driver to 91.47. just not work . but nothing can got by glGetProgramiv(,GL_INFO_LOG_LENGTH) ;

Anyone known why?

You should get a warning like

Warning: varying Texcoord is written to in the vertex shader but not read in the fragment shader.
Link successful. The GLSL vertex shader will run in hardware. The GLSL fragment shader will run in hardware.

Yes , I had saw this warnning. but not always. :frowning:

I think that should generate an error, assuming you actually reference the varying in question in the fragment shader. The spec seems to state that a fragment shader can only read varyings that the vertex shader actually writes to.

Though in my humble opinion an error is a bit harsh. A warning would do nicely, I think, like what V-man described.

Personally, I get no errors or messages of any kind in the logs (NV40, FW91.47).

Originally posted by Leghorn:

Personally, I get no errors or messages of any kind in the logs (NV40, FW91.47).

The example log from V-man is specific to the ATI cards. On Nvidia cards I have seen only compilation errors and, in the latest drivers, warnings when nonstandard elements from Cg are used in glsl.

On Nvidia cards I have seen only compilation errors
Are you using beta drivers?

Try something like this:

void main() 
{
    gl_Position = ftransform();
}

...

// Varying NaughtyVec4 is not declared or used in the vertex shader
varying vec4 NaughtyVec4;
void main() 
{
    gl_FragColor = NaughtyVec4;
}

I get no errors or warnings in program or shader logs during compilation, linking, validation or runtime.

Probably splitting hairs here, and I probably wouldn’t have noticed this myself until being mugged by a ruinous typo around 4am.

Personally, I get no errors or messages of any kind in the logs (NV40, FW91.47).
In FW84.26 , these two shader even works well.
I think maybe because of case sensitive

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