On 05/11/2012 11:03 AM, Paul Berry wrote:
Gen6 MSAA buffers (and Gen7 MSAA depth/stencil buffers) interleave
MSAA samples in a complex pattern that repeats every 2x2 pixel block.
Therefore, when allocating an MSAA buffer, we need to make sure to
allocate an integer number of 2x2 blocks; if we don't, then some of
the samples in the last row and column will be cut off.
Fixes piglit tests "EXT_framebuffer_multisample/unaligned-blit {2,4}
color msaa" on i965/Gen6.
---
src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 99f4230..36d7b77 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -261,15 +261,20 @@ intel_miptree_create_for_renderbuffer(struct
intel_context *intel,
{
struct intel_mipmap_tree *mt;
- /* Adjust width/height for MSAA */
+ /* Adjust width/height for MSAA. Note: since samples are interleaved in a
+ * complex pattern that repeats for every 2x2 block of pixels, we need to
+ * expand the width and height to even numbers before the width/height
+ * adjustment, otherwise some of the samples in the last row and column
+ * will fall outside the boundary of the texture.
+ */
if (num_samples> 4) {
num_samples = 8;
- width *= 4;
- height *= 2;
+ width = ALIGN(width, 2) * 4;
+ height = ALIGN(height, 2) * 2;
Obviously, this hasn't been tested, so it may need to change in the
future...
} else if (num_samples> 0) {
num_samples = 4;
- width *= 2;
- height *= 2;
+ width = ALIGN(width, 2) * 2;
+ height = ALIGN(height, 2) * 2;
}
mt = intel_miptree_create(intel, GL_TEXTURE_2D, format, 0, 0,
I wish there were some documentation to point at. But there isn't, so...
Acked-by: Kenneth Graunke <kenn...@whitecape.org>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev