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

Thread: ATi, Accessing texture level below TEXTURE_BASE

  1. #1
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    445

    ATi, Accessing texture level below TEXTURE_BASE

    Hi,
    using Ati Mobility Radeon HD 5650 with Catalyst 11.8 drivers, I noticed that this causes an AV at the glTexImage2D call:
    Code :
      glGenBuffers(1, @PBO);
      glBindBuffer(GL_PIXEL_UNPACK_BUFFER, PBO);
      glBufferData(GL_PIXEL_UNPACK_BUFFER, twidth*theight*4, @data, GL_STATIC_DRAW);
     
      glGenTextures(1, @tex);
      glBindTexture(GL_TEXTURE_2D, tex);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 1);
      glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, twidth, theight, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0);
    It's unusual calling glTexImage for a level beneath GL_TEXTURE_BASE_LEVEL, but AFAICT shouldn't cause an AV.

    Something else that causes an AV when it comes to render using a texture, is having GL_TEXTURE_MAX_LEVEL < GL_TEXTURE_BASE_LEVEL, eg.
    Code :
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 4);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
    This is one of the listed checks of texture completeness, so should handle it cleanly rather than causing an AV.


  2. #2

  3. #3
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    445

    Re: ATi, Accessing texture level below TEXTURE_BASE

    Sorry, AV = Access Violation.

  4. #4
    Intern Newbie
    Join Date
    Sep 2011
    Posts
    32

    Re: ATi, Accessing texture level below TEXTURE_BASE

    Is it caused by glBufferData? I removed PBO stuff and found no AV in the glTexImage.See if upgrading to 11.9 works.
    Senior Engineer, OpenGL driver, AMD

  5. #5
    Member Regular Contributor
    Join Date
    Aug 2008
    Posts
    445

    Re: ATi, Accessing texture level below TEXTURE_BASE

    The access violation "Access violation at 03E7C870 in module 'atioglxx.dll'. Read of address 00000000" occurs at the glTexImage2D call, but only when a buffer object is bound to GL_PIXEL_UNPACK_BUFFER.
    eg. This doesn't throw an AV:
    Code :
    glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
    glGenTextures(1, @tex);
    glBindTexture(GL_TEXTURE_2D, tex);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 1);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, twidth, theight, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0);
    and uploading to a level >= GL_TEXTURE_BASE_LEVEL works fine, but this throws an AV:
    Code :
     
      glGenBuffers(1, @PBO);
      glBindBuffer(GL_PIXEL_UNPACK_BUFFER, PBO);
      glBufferData(GL_PIXEL_UNPACK_BUFFER, twidth*theight*4, nil, GL_STATIC_DRAW); // nil = NULL equivalent
     
      glGenTextures(1, @tex);
      glBindTexture(GL_TEXTURE_2D, tex);
      glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 4);
      // AV when (0 <= level < GL_TEXTURE_BASE_LEVEL)
      glTexImage2D(GL_TEXTURE_2D, 2, GL_RGBA, twidth, theight, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0);

    The 2nd issue appears to be fixed, since:
    Code :
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 4);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 1);
    no longer causes an AV on draw calls in 11.9, but correctly detects an incomplete texture + renders a white triangle.

    Another issue with glTexImage2D when a PBO is bound is that if you try loading a high image level, you get an out of memory error (or potentially a very big texture allocated), which you don't get if no PBO is bound.
    Code :
      glGenBuffers(1, @PBO);
      glBindBuffer(GL_PIXEL_UNPACK_BUFFER, PBO);
      glBufferData(GL_PIXEL_UNPACK_BUFFER, twidth*theight*4, nil, GL_STATIC_DRAW);
      // adding this line prevents out of memory error
      // glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
     
      glGenTextures(1, @tex);
      glBindTexture(GL_TEXTURE_2D, tex);
      //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 9);
      //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 10);
      glTexImage2D(GL_TEXTURE_2D, 10, GL_RGBA, 32, 32, 0, GL_BGRA, GL_UNSIGNED_BYTE, nil);
      CheckOpenGLError(); // out of memory

  6. #6
    Intern Newbie
    Join Date
    Sep 2011
    Posts
    32

    Re: ATi, Accessing texture level below TEXTURE_BASE

    Got it. I reproduced your bug in my machine. It is indeed a driver bug: some NULL pointer is referred when PBO and texture are used at the same time. Thanks for pointing it out. We'll fix it in the next version of catalyst driver.
    Senior Engineer, OpenGL driver, AMD

Posting Permissions

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