[Mesa-dev] [PATCH 3/3] swrast: map/unmap attachments, not renderbuffers in glReadPixels

Brian Paul brian.e.paul at gmail.com
Sat Nov 5 15:06:42 PDT 2011

On Sat, Nov 5, 2011 at 1:15 PM, Brian Paul <brianp at vmware.com> wrote:
> Most drivers have been creating fake/wrapper renderbuffers when a
> texture image is attached to an FBO.  But that's not a requirement
> of core Mesa.
> So an FBO attachment that points into a texture may not have a
> (fake) renderbuffer.  This caused the new glReadPixels code to fail
> when reading from a buffer that's actually a texture.
> Now, we check the attachment point to see if it's a real renderbuffer
> or a texture image and call the corresponding MapRenderbuffer() or
> MapTextureImage() function.
> This fixes a bunch of piglit fbo failures when using the non-DRI
> swrast driver.

Rereading this, the description leaves out another important detail.

Unlike the DRI drivers and gallium drivers, the swrast driver doesn't
have a common underlying memory object that stores both textures and
renderbuffers.  That makes the texture renderbuffer wrapper approach
messy.  Explicitly calling MapRenderbuffer or MapTextureImage here
avoids that.


More information about the mesa-dev mailing list