Mesa (10.0): i965/gen6: Fix multisample resolve blits for luminance/ intensity 32F formats.
Ian Romanick
idr at kemper.freedesktop.org
Fri Dec 6 16:11:35 UTC 2013
Module: Mesa
Branch: 10.0
Commit: 2457b5bfa48096dde63cb5a14d9db94bccc6767d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2457b5bfa48096dde63cb5a14d9db94bccc6767d
Author: Paul Berry <stereotype441 at gmail.com>
Date: Wed Nov 27 07:43:03 2013 -0800
i965/gen6: Fix multisample resolve blits for luminance/intensity 32F formats.
On gen6, multisamble resolve blits use the SAMPLE message to blend
together the 4 samples for each texel. For some reason, SAMPLE
doesn't blend together the proper samples when the source format is
L32_FLOAT or I32_FLOAT, resulting in blocky artifacts.
To work around this problem, sample from the source surface using
R32_FLOAT. This shouldn't affect rendering correctness, because when
doing these resolve blits, the destination format is R32_FLOAT, so the
channel replication done by L32_FLOAT and I32_FLOAT is unnecessary.
Fixes piglit tests on Sandy Bridge:
- spec/ARB_texture_float/multisample-formats 2 GL_ARB_texture_float
- spec/ARB_texture_float/multisample-formats 4 GL_ARB_texture_float
No piglit regressions on Sandy Bridge.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70601
Cc: Kenneth Graunke <kenneth at whitecape.org>
Cc: mesa-stable at lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
(cherry picked from commit c4cf487315f1f5375534f1677177983fa496d577)
---
src/mesa/drivers/dri/i965/brw_blorp_blit.cpp | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 7e436f7..bbb8cb0 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -2102,6 +2102,21 @@ brw_blorp_blit_params::brw_blorp_blit_params(struct brw_context *brw,
src.brw_surfaceformat = dst.brw_surfaceformat;
}
+ /* When doing a multisample resolve of a GL_LUMINANCE32F or GL_INTENSITY32F
+ * texture, the above code configures the source format for L32_FLOAT or
+ * I32_FLOAT, and the destination format for R32_FLOAT. On Sandy Bridge,
+ * the SAMPLE message appears to handle multisampled L32_FLOAT and
+ * I32_FLOAT textures incorrectly, resulting in blocky artifacts. So work
+ * around the problem by using a source format of R32_FLOAT. This
+ * shouldn't affect rendering correctness, since the destination format is
+ * R32_FLOAT, so only the contents of the red channel matters.
+ */
+ if (brw->gen == 6 && src.num_samples > 1 && dst.num_samples <= 1 &&
+ src_mt->format == dst_mt->format &&
+ dst.brw_surfaceformat == BRW_SURFACEFORMAT_R32_FLOAT) {
+ src.brw_surfaceformat = dst.brw_surfaceformat;
+ }
+
use_wm_prog = true;
memset(&wm_prog_key, 0, sizeof(wm_prog_key));
More information about the mesa-commit
mailing list