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

Thread: ATi GLSL/VBO bug (4.1)

  1. #1

    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)

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

  2. #2

    Re: ATi GLSL/VBO bug (4.1)

    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).]

  3. #3
    Intern Contributor
    Join Date
    Nov 2003
    Location
    Russia / Saint-Petersburg
    Posts
    50

    Re: ATi GLSL/VBO bug (4.1)

    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).

Posting Permissions

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