PDA

View Full Version : A very strange bug(really a bug? ) of NVIDIA's GLSL implemention



stanlylee
10-10-2006, 08:09 AM
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 .. :(
upgrade driver to 91.47. just not work . but nothing can got by glGetProgramiv(,GL_INFO_LOG_LENGTH) ;

Anyone known why?

V-man
10-11-2006, 01:44 AM
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.

stanlylee
10-11-2006, 07:32 AM
Yes , I had saw this warnning. but not always. :(

Brolingstanz
10-12-2006, 05:14 AM
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).

Komat
10-12-2006, 09:19 AM
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.

Brolingstanz
10-12-2006, 10:58 AM
On Nvidia cards I have seen only compilation errorsAre 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.

stanlylee
10-12-2006, 07:32 PM
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