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

Thread: Attribute binding bug on ATI?

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    2

    Attribute binding bug on ATI?

    Hi,

    I have a problem with my OpenGL program on my Radeon HD6950. I tried to render a square with a simple vertex shader (only one attribute: position). I am explicitly binding my vertex attributes to specific indices via glBindAttribLocation prior to glLinkProgram. In this case I bound 'in vec3 VertexPosition' to index 1 and enabled it in my vertexarray object.
    Code :
    glBindAttribLocation(programId, 1, "VertexPosition");
    glLinkProgram(programId);
     
    ...
     
    glBindVertexArray(vertexArrayId);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, ...);
    But when I use an index of 0, the geometry gets drawn! This made me wanting to know if it was my fault for thinking that I could use any index from 0 to MAX_ATTRIBS or if it was a driver bug, so I sent the test program to a friend of mine, who uses an NVidia graphics card. He told me that both versions, with index 0 and 1, worked for him. That made me curious and through Google I found a closed thread in this forum that explained that it is a driver bug (I can't link it here?).

    My question now is: Is this bug still not fixed, or is it a problem on my side? I am using an OpenGL 3.0 context at the moment (because of compatibility and SDL and stuff), maybe it will fix if I move on to a 3.2 core context?
    Last edited by Bl00drav3n; 01-31-2013 at 07:52 AM.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    985
    If you use a compatibility context (which you probably do) then vertex attribute index 0 is mandatory. Switching to a core context should fix your issue.
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

  3. #3
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    I am using an OpenGL 3.0 context at the moment (because of compatibility and SDL and stuff)
    I rather doubt that. Odds are good that your driver is giving you whatever version it wants, just using the compatibility profile. So you're probably getting 3.3 or 4.2, assuming recent drivers.

    In any case, yes, this is a long-standing AMD driver bug; the core profile should allow you to not need attribute 0. Both NVIDIA and AMD violate the spec on this. NVIDIA allows you to not use attribute 0 even on compatibility (where that's not legal, but see below), and AMD requires you to use it even in core.

    The workaround is to always use attribute 0. I wouldn't expect AMD to fix this anytime soon.

    If you use a compatibility context (which you probably do) then vertex attribute index 0 is mandatory. Switching to a core context should fix your issue.
    Actually, that's no longer true for 4.3 compatibility. Because of the way they redefined how rendering works in compatibility, core and compatibility are defined to operate in the same way.

  4. #4
    Junior Member Newbie
    Join Date
    Jan 2013
    Posts
    2
    Thanks for the quick replies! I updated my code to be compatible with 3.2 core and set attribute 0, everything is working now.

    Edit:
    Quote Originally Posted by Alfonse Reinheart View Post
    I rather doubt that. Odds are good that your driver is giving you whatever version it wants, just using the compatibility profile. So you're probably getting 3.3 or 4.2, assuming recent drivers.
    I checked the GL version for my updated program:
    Code :
    Vendor: ATI Technologies Inc.
    Renderer: AMD Radeon HD 6900 Series
    Version: 3.2.12002 Core Profile Context 9.12.0.0
    GLSL Version: 4.20
    Last edited by Bl00drav3n; 01-31-2013 at 07:57 AM.

Posting Permissions

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