Another similar patch proposal : handling of PIPE_FORMAT_B8G8R8X8_UNORM format in st_fast_readpixels.
If I'm correct the 'X' of B8G8R8X8 in stands for 'whatever value' so I think we could use the same code path for both PIPE_FORMAT_B8G8R8A8_UNORM and PIPE_FORMAT_B8G8R8X8_UNORM. (Blender uses glReadPixels + PIPE_FORMAT_B8G8R8X8_UNORM when right mouse clicking in Edit-Mode) On Thu, Apr 14, 2011 at 3:52 PM, Brian Paul <bri...@vmware.com> wrote: > On 04/13/2011 05:29 AM, Pierre-Eric wrote: >> >> As Lightsmark seems to make use of glReadPixels with {GL_RGBA + >> GL_UNSIGNED_INT_8_8_8_8} parameters, >> I built a short patch to allow 'st_fast_readpixels' to handle this >> combination. >> >> It's been tested using piglit's pixelFormat test + a custom app. >> >> Best regards, >> --Pierre-Eric > > Thanks. I'll commit it soon. > > -Brian > >
From fdf4befce519832582921a4291066319c0283bbc Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer <pell...@gmail.com> Date: Thu, 14 Apr 2011 16:58:50 +0200 Subject: [PATCH] Add handling for 'PIPE_FORMAT_B8G8R8X8_UNORM' in st_fast_readpixels --- src/mesa/state_tracker/st_cb_readpixels.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index fdb7770..047e398 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -208,20 +208,20 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb, if (ctx->_ImageTransferState) return GL_FALSE; - if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM && - format == GL_RGBA && type == GL_UNSIGNED_BYTE) { + if (strb->format != PIPE_FORMAT_B8G8R8A8_UNORM && + strb->format != PIPE_FORMAT_B8G8R8X8_UNORM ) + return GL_FALSE; + + if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) { combo = A8R8G8B8_UNORM_TO_RGBA_UBYTE; } - else if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM && - format == GL_RGB && type == GL_UNSIGNED_BYTE) { + else if (format == GL_RGB && type == GL_UNSIGNED_BYTE) { combo = A8R8G8B8_UNORM_TO_RGB_UBYTE; } - else if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM && - format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV) { + else if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV) { combo = A8R8G8B8_UNORM_TO_BGRA_UINT; } - else if (strb->format == PIPE_FORMAT_B8G8R8A8_UNORM && - format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8) { + else if (format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8) { combo = A8R8G8B8_UNORM_TO_RGBA_UINT; } else { -- 1.7.4.1
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev