[Mesa-dev] [PATCH 5/5] st/mesa: fix ReadPixels crashes when reading depth/stencil from a FBO
Marek Olšák
maraeo at gmail.com
Sat Aug 14 08:47:35 PDT 2010
NOTE: This is a candidate for the 7.8 branch.
---
src/mesa/state_tracker/st_cb_readpixels.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c
index b8493da..3cfb262 100644
--- a/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/src/mesa/state_tracker/st_cb_readpixels.c
@@ -63,11 +63,16 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
{
struct gl_framebuffer *fb = ctx->ReadBuffer;
struct pipe_context *pipe = st_context(ctx)->pipe;
- struct st_renderbuffer *strb = st_renderbuffer(fb->_StencilBuffer);
+ struct st_renderbuffer *strb;
struct pipe_transfer *pt;
ubyte *stmap;
GLint j;
+ if (fb->_StencilBuffer->Wrapped)
+ strb = st_renderbuffer(fb->_StencilBuffer->Wrapped);
+ else
+ strb = st_renderbuffer(fb->_StencilBuffer);
+
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
y = ctx->DrawBuffer->Height - y - height;
}
@@ -358,7 +363,11 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
return;
}
else if (format == GL_DEPTH_COMPONENT) {
- strb = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
+ struct gl_renderbuffer *depthRb = ctx->ReadBuffer->_DepthBuffer;
+ if (depthRb->Wrapped)
+ strb = st_renderbuffer(depthRb->Wrapped);
+ else
+ strb = st_renderbuffer(depthRb);
}
else {
/* Read color buffer */
--
1.7.0.4
More information about the mesa-dev
mailing list