st/mesa: fix ReadPixels crashes when reading depth/stencil from a FBO

This is based on a patch from Marek Olšák.

NOTE: This is a candidate for the Mesa 7.8 branch.
This commit is contained in:
Brian Paul 2010-08-22 19:04:47 -06:00
parent c94256e83b
commit 6b90d1b1ac
1 changed files with 7 additions and 0 deletions

View File

@ -68,6 +68,10 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
ubyte *stmap;
GLint j;
if (strb->Base.Wrapped) {
strb = st_renderbuffer(strb->Base.Wrapped);
}
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
y = ctx->DrawBuffer->Height - y - height;
}
@ -359,6 +363,9 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
}
else if (format == GL_DEPTH_COMPONENT) {
strb = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer);
if (strb->Base.Wrapped) {
strb = st_renderbuffer(strb->Base.Wrapped);
}
}
else {
/* Read color buffer */