Mesa (master): gallium: Add util_blend_uses_dest helper

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 24 11:56:36 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Aug 20 11:45:38 2020 -0400

gallium: Add util_blend_uses_dest helper

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6407>

---

 src/gallium/auxiliary/util/u_blend.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_blend.h b/src/gallium/auxiliary/util/u_blend.h
index 7fca2fab6d1..7fccdb26d31 100644
--- a/src/gallium/auxiliary/util/u_blend.h
+++ b/src/gallium/auxiliary/util/u_blend.h
@@ -132,4 +132,14 @@ util_blend_factor_uses_dest(enum pipe_blendfactor factor, bool alpha)
    }
 }
 
+static inline bool
+util_blend_uses_dest(struct pipe_rt_blend_state rt)
+{
+   return rt.blend_enable &&
+      (util_blend_factor_uses_dest(rt.rgb_src_factor, false) ||
+       util_blend_factor_uses_dest(rt.alpha_src_factor, true) ||
+       rt.rgb_dst_factor != PIPE_BLENDFACTOR_ZERO ||
+       rt.alpha_dst_factor != PIPE_BLENDFACTOR_ZERO);
+}
+
 #endif /* U_BLEND_H */



More information about the mesa-commit mailing list