Mesa (master): meta/blit: Don't blend integer values during MSAA resolves

Jason Ekstrand jekstrand at kemper.freedesktop.org
Tue May 10 22:32:08 UTC 2016


Module: Mesa
Branch: master
Commit: 4f4f393bf303887e1dbedf495780f41f6a313a92
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4f4f393bf303887e1dbedf495780f41f6a313a92

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed May  4 15:52:50 2016 -0700

meta/blit: Don't blend integer values during MSAA resolves

Reviewed-by: Matt Turner <mattst88 at gmail.com>

---

 src/mesa/drivers/common/meta_blit.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 6761238..20d3215 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -458,8 +458,17 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx,
          int step;
 
          if (src_datatype == GL_INT || src_datatype == GL_UNSIGNED_INT) {
-            merge_function =
-               "gvec4 merge(gvec4 a, gvec4 b) { return (a >> gvec4(1)) + (b >> gvec4(1)) + (a & b & gvec4(1)); }\n";
+            /* From the OpenGL ES 3.2 spec section 16.2.1:
+             *
+             *    "If the source formats are integer types or stencil values,
+             *    a single sample's value is selected for each pixel."
+             *
+             * The OpenGL 4.4 spec contains exactly the same language.
+             *
+             * We can accomplish this by making the merge function return just
+             * one of the two samples.  The compiler should do the rest.
+             */
+            merge_function = "gvec4 merge(gvec4 a, gvec4 b) { return a; }\n";
          } else {
             /* The divide will happen at the end for floats. */
             merge_function =




More information about the mesa-commit mailing list