ATi GLSL/VBO bug (4.1)

Since upgrading to the 4.1 drivers, I’ve found that certain shaders cause VBO to crash. For example, the following vertex shader crashes with VBO (modified version of 3DLabs’ wood shader)

attribute vec4 weight;

varying float lightIntensity;
varying vec3 Position;
uniform vec3 LightPosition;
uniform float Scale;

void main(void) {
vec4 pos = gl_ModelViewMatrix * gl_Vertex;
Position = vec3(gl_Vertex) * Scale;
vec3 tnorm = normalize(gl_NormalMatrix * gl_Normal);
lightIntensity = abs(dot(normalize(LightPosition - vec3(pos)), tnorm) * 1.5);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_FrontColor = weight;
}

If I comment out the last line so that it ignores the weight attribute, or if I use standard vertex arrays, the code runs fine. I’ve double checked my vertex array class and I can’t find any problem.

Note that it doesn’t matter whether or not I specify a vertex attribute array. The only way to stop it crashing is to disable VBO or remove that line from the shader.

The crash itself is really odd, in that I can’t trace the location in the VC++ debugger. It just gives me an access violation reading location 0x0000000 and then dumps me somewhere in the vertex array code which is not where it was before the crash.

I’m thinking it’s an issue with using VBO, GLSL and vertex attributes together. Has anyone else stumbled across this problem?

As a workaround, I’m using the multitexture coordinates instead. It seems to work fine now.

[This message has been edited by bunny (edited 02-06-2004).]

I’ve the same problem with VBO and fragment shader:

varying vec2 TexCoord0;
uniform sampler2D Texture0;

uniform float WorldTime;

void main()
{
vec4 Color = vec4(texture2D(Texture0, TexCoord0));

if ( bool(lessThan(Color, vec4(0.1, 0.1, 0.1, 0))) ) discard;

gl_FragColor = Color + vec4(gl_FragCoord.x, gl_FragCoord.y, 0.0, 0.0) * 0.0005 * sin(WorldTime);
}

Elimination of gl_FragColor resolves the problem (as a workaround).

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