summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2020-08-20 11:45:38 -0400
committerMarge Bot <eric+marge@anholt.net>2020-08-24 11:42:34 +0000
commite0554634592b4dd616bcc51d3e941f86e7bec044 (patch)
tree45a7348b864ae9ec0aa79946afe0697721bb1036
parente05930511b7d3dafa36cc8d2dca51767edeff3b9 (diff)
gallium: Add util_blend_uses_dest helper
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>
-rw-r--r--src/gallium/auxiliary/util/u_blend.h10
1 files changed, 10 insertions, 0 deletions
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 */