[Mesa-dev] [PATCH 01/15] i965/msaa: Expand odd-sized MSAA surfaces to account for interleaving pattern.
Paul Berry
stereotype441 at gmail.com
Fri May 11 11:03:44 PDT 2012
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;
} 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,
--
1.7.7.6
More information about the mesa-dev
mailing list