From: Alyssa Rosenzweig Date: Thu, 20 Aug 2020 15:45:38 +0000 (-0400) Subject: gallium: Add util_blend_uses_dest helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e0554634592b4dd616bcc51d3e941f86e7bec044;p=mesa.git gallium: Add util_blend_uses_dest helper Signed-off-by: Alyssa Rosenzweig Reviewed-by: Eric Anholt Reviewed-by: Marek Olšák Part-of: --- 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 */