[Mesa-dev] [PATCH 2/4] i965/gen6+: Fix copying of stencil images in blorp CopyTexSubImage path.
Paul Berry
stereotype441 at gmail.com
Sun Jun 2 16:50:43 PDT 2013
When handling the depth/stencil case of CopyTexSubImage using blorp,
we weren't paying attention to intel_mipmap_tree::stencil_mt field; as
a result we were sometimes attempting to read and/or write stencil
data using the depth miptree, resulting in image corruption.
Fixes some failures with piglit tests "copyteximage
{1D,2D,CUBE,RECT,2D_ARRAY}".
---
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 0a9aca8..3417a99 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -380,16 +380,20 @@ brw_blorp_copytexsubimage(struct intel_context *intel,
dstX0, dstY0, dstX1, dstY1,
false, mirror_y);
- /* If we're copying to a packed depth stencil texture and the source
- * framebuffer has separate stencil, we need to also copy the stencil data
- * over.
+ /* Blorp only ever copies one miptree at a time. Since Gen6+ uses separate
+ * stencil buffers, this means that the above copy just copied depth. If
+ * we're copying to a depth/stencil texture and the source framebuffer has
+ * stencil, we need to also copy the stencil data over.
*/
src_rb = ctx->ReadBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
if (_mesa_get_format_bits(dst_image->TexFormat, GL_STENCIL_BITS) > 0 &&
src_rb != NULL) {
src_irb = intel_renderbuffer(src_rb);
- if (src_irb->mt != src_mt)
-
+ src_mt = src_irb->mt;
+ if (src_mt->stencil_mt)
+ src_mt = src_mt->stencil_mt;
+ if (dst_mt->stencil_mt)
+ dst_mt = dst_mt->stencil_mt;
brw_blorp_blit_miptrees(intel,
src_irb->mt, src_irb->mt_level, src_irb->mt_layer,
dst_mt, dst_image->Level, dst_image->Face,
--
1.8.3
More information about the mesa-dev
mailing list