FBO GenerateMipmapExt() on non-square texture crash

Hi folks,

I’m having some trouble with FBO’s especially on ATI hardware.

One problem is that it crashes (in atioglxx.dll) when I try to use GenerateMipmapExt() on a 256 x 128 texture.

This is the relevant code:

void initBuffers()
{
 // create objects
 glGenFramebuffersEXT(1, &fb_);        // Frame buffer object
 glGenTextures(1, &handle_);           // Texture handle
 
 // Make frame buffer active
 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_);
 
 // Initialize texture
 glBindTexture(target_, handle_);
 applyTexParameters(target_);

 glTexImage2D(target_, 0, GL_RGBA8, width_, height_, 0, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*)NULL);

 // Establish a mipmap chain
 if(min_filter_ != GL_NEAREST &&
    min_filter_ != GL_LINEAR)
    glGenerateMipmapEXT(target_);
 
 // Attach texture to framebuffer color buffer
 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, target_, handle_, 0);

 // Check framebuffer status
 GLuint status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
 if(status != GL_FRAMEBUFFER_COMPLETE_EXT)
    {
    logError() << "GngFBOTexture: initBuffers() failed, FBO not complete!: " << endl;
    result = false;
    switch(status)
       {
       case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
          logError() << "Reason: FRAMEBUFFER_INCOMPLETE_ATTACHMENT" << endl;
          break;
        ... more cases ...
       }
    }
 
 // Set rendering to window
 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}

What happens is that glCheckFramebufferStatusEXT() returns GL_FRAMEBUFFER_COMPLETE_EXT. When that happens, my code cleans up the FBO object with:

  
glDeleteFramebuffersEXT(1, &fb_);
glDeleteTextures(1, &handle_);

Which apparently makes it crash.

This code works on NVIDIA, and on Mac OSX with the same ATI card (X1600). Removing glGenerateMipmapEXT or changing the size to 256x256 fixes the problem on ATI/windows too.

Another problem is that updating the texture apparently doesn’t work. I need to delete the teture object and then reinitialize to get the changes.

Any help would be greatly appreciated

Cheers!

Sounds like a driver bug. Send it to ATi along with a sample application.

Yes, I had the same problem with glGenerateMipmapEXT while it worked perfectly on GeForce.