meta/blit: Don't blend integer values during MSAA resolves
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 4 May 2016 22:52:50 +0000 (15:52 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 10 May 2016 22:31:50 +0000 (15:31 -0700)
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/common/meta_blit.c

index 6761238b01434e67ae23e9c90997c57acfa11087..20d321579d52dcaa5a063c1c107bd0d4e6360a22 100644 (file)
@@ -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 =