PBO readback: different color format ATI vs NVIDIA


We have an application that reads back data from the backbuffer asynchronously by using PBOs.

Every odd frame we copy the backbuffer to the PBO using glReadpixels

glBindBuffer(GL_PIXEL_PACK_BUFFER_EXT, pixelBuffer);
glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, NULL);

Every even frame we analyse the data by mapping the PBO:

glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, pixelBuffer);

This works great on NVIDIA cards without a big performance hit.
It also works on ATI cards except the red and blue color components are flipped.

Using GL_RGBA in glReadpixels causes both cards to return the colors in the same order but causes nvidia performance to drop bigtime (because it has to flip the colors).

Asking the pixel format to the device context gives us the same values on nvidia and ati: resdhift is always 16 blueshift is always 0 and greenshift is always 8.

iPixelFormat = GetPixelFormat(hdc);
DescribePixelFormat(hdc, iPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);

Does anyone know whats going on here?

Thanks in advance

If you say above ATI is returning identical data in GL_RGBA and GL_BGRA format, that would be a bug inside their glReadPixels code.

Yes it seems to be a bug indeed.
We will try a different ati card on xp in stead of vista today and see what happens…

The other machine has the same problem. It really seems to be a driver issue.