[Mesa-dev] [PATCH 01/15] i965/msaa: Expand odd-sized MSAA surfaces to account for interleaving pattern.
Chad Versace
chad.versace at linux.intel.com
Tue May 22 12:13:09 PDT 2012
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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;
> } 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,
The comment makes it very clear what's happening.
I encountered a similiar issue, with a similiar fix, with stencil buffers.
Reviewed-by: Chad Versace <chad.versace at linux.intel.com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQIcBAEBAgAGBQJPu+VEAAoJEAIvNt057x8iFbQP/0nZCSU8s2zx+KZrWBifzHT3
H/xNUcnDtaDHxaIH/1T7LHqRZca6gmZPx1afnPFFSNDC4KhkRWJI1OtwlPe0aeCL
YKFc0+x1P17ERhT1+ci9x0JlNkcPlfq2l1WiP4/jPqJuRbMHtVhhG8X1D54wA8Nk
eawEWXBFGCNKgAgAzhhPRG2X5WLXce80a4KstZzJz0LFLEglBEG3Dmg7sq0FTk/k
mNdbUNTGcJ+e6USbDMc6sKmsS9lPXaQZ67MhBP0Bij8PVaxcmdGShMI+PLSJWkDx
kjXECaR/Qt4/afUNZpdDAXFy+Hj5F8pXnIMG68Taqi53SFtIY2GAG6mHLz8wTX6H
Ur2SAe72xUT8g+75OjwRSwzhWxPVDQe1e25369wkVWcyZ4YPgY1PwQzr/Ozt/4e2
/WFfdERwgHNso5a/ByNoaVvxDQ13kZDkkd3dQqxG/pN30ycPHlELbb8CC1mgTTjA
acOuR71hQujUpta3WjoJAVxP5/vNkP7nWofWlsUNZNa+2sjfkittFmEIT/OECczw
6zHVmGRolyjyihIqEx6pJvxGC/VEuuqcbkK/iw7ml1J7bes+4jY/GO0imOvT4SyG
t0XRhgthYA4rABx6CfqdbhpMjUwnjH3ATGyxE+ts4zDNyaF1m/xf6LpwDp9Fl1pc
0tQncRt6rXpkkw8JVExF
=XShQ
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list