ATI multisample glBlitFramebuffer driver bug

Nasty ATI OpenGL driver bug when using a multisample framebuffer (FBO) with a GL_DEPTH24_STENCIL8_EXT renderbuffer attached

During the last few days I was wondering why the lens flare in one of my OpenGL games was broken on the ATI Radeon HD 5850 with latest drivers. On my NVidia 8800 GTS and ATI Mobility Radeon HD 3400 everything was working fine.

But on the 5850 both of the following glReadPixels calls always returned zero (0.0f) for Zf or Zi when a framebuffer object was bound which was downsampled from a multisampled framebuffer with a GL_DEPTH24_STENCIL8_EXT renderbuffer attached.

GLfloat Zf;
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &Zf);

unsigned int Zi;
glReadPixels(x, y, 1, 1, GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, &Zi);

The downsampling was done using glBlitFramebufferEXT like this:

glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, Handle_MS);
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,  Handle);

glBlitFramebufferEXT(0, 0, Width, Height, 0,  0, Width, Height, GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT,  GL_NEAREST);

A workaround is to call glBlitFramebufferEXT without the GL_STENCIL_BUFFER_BIT flag although we are working on a packed depth stencil buffer.

glBlitFramebufferEXT(0, 0, Width, Height, 0,  0, Width, Height, GL_DEPTH_BUFFER_BIT,  GL_NEAREST);

Otherwise the depth values will not be copied from the multisampled renderbuffer to the singlesampled one or at least not on the ATI Radeon HD 5850 with the following driver version:

Driver Packaging Version    8.732-100504a-099996C-ATI
Catalyst™ Version    10.5
Provider    ATI Technologies Inc.
2D Driver Version    8.01.01.1030
2D Driver File Path    /REGISTRY/MACHINE/SYSTEM/ControlSet001/Control/CLASS/{4D36E968-E325-11CE-BFC1-08002BE10318}/0001
Direct3D Version    8.14.10.0753
OpenGL Version    6.14.10.9836
Catalyst™ Control Center Version    2010.0504.2152.37420

Dieser Beitrag wurde unter IT abgelegt und mit , , , , , , , , , , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.