Mesa (main): panfrost: Fix is_opaque when blend_enable=false

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 11 18:32:47 UTC 2021


Module: Mesa
Branch: main
Commit: 01a1b253b43b18d81dba14d7601119b7acdde97e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=01a1b253b43b18d81dba14d7601119b7acdde97e

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Fri Jul 30 18:04:05 2021 -0400

panfrost: Fix is_opaque when blend_enable=false

Needed to pass the "replace" unit test.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12152>

---

 src/panfrost/lib/pan_blend.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/lib/pan_blend.c b/src/panfrost/lib/pan_blend.c
index 4dd5fc00956..c2b7d99f5ba 100644
--- a/src/panfrost/lib/pan_blend.c
+++ b/src/panfrost/lib/pan_blend.c
@@ -237,6 +237,16 @@ to_panfrost_function(enum blend_func blend_func,
 bool
 pan_blend_is_opaque(const struct pan_blend_equation equation)
 {
+        /* If a channel is masked out, we can't use opaque mode even if
+         * blending is disabled, since we need a tilebuffer read in there */
+        if (equation.color_mask != 0xF)
+                return false;
+
+        /* With nothing masked out, disabled bledning is opaque */
+        if (!equation.blend_enable)
+                return true;
+
+        /* Also detect open-coded opaque blending */
         return equation.rgb_src_factor == BLEND_FACTOR_ZERO &&
                equation.rgb_invert_src_factor &&
                equation.rgb_dst_factor == BLEND_FACTOR_ZERO &&
@@ -248,8 +258,7 @@ pan_blend_is_opaque(const struct pan_blend_equation equation)
                equation.alpha_dst_factor == BLEND_FACTOR_ZERO &&
                !equation.alpha_invert_dst_factor &&
                (equation.alpha_func == BLEND_FUNC_ADD ||
-                equation.alpha_func == BLEND_FUNC_SUBTRACT) &&
-               equation.color_mask == 0xf;
+                equation.alpha_func == BLEND_FUNC_SUBTRACT);
 }
 
 static bool



More information about the mesa-commit mailing list