gallium: Add util_blend_uses_dest helper
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 20 Aug 2020 15:45:38 +0000 (11:45 -0400)
committerMarge Bot <eric+marge@anholt.net>
Mon, 24 Aug 2020 11:42:34 +0000 (11:42 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6407>

src/gallium/auxiliary/util/u_blend.h

index 7fca2fab6d18594cdf4165cf168342f6a17fb3ca..7fccdb26d3168c21fdb64e4ec0cd10ed29ca4aa1 100644 (file)
@@ -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 */