[Mesa-dev] [PATCH 5/7] util: add dual blend helper function

Brian Paul brianp at vmware.com
Wed Apr 4 08:15:34 PDT 2012


On 04/03/2012 07:16 AM, Dave Airlie wrote:
> From: Dave Airlie<airlied at redhat.com>
>
> This is just a function to tell if a certain blend mode requires dual sources.
>
> Signed-off-by: Dave Airlie<airlied at redhat.com>
> ---
>   src/gallium/auxiliary/util/u_dual_blend.h |   23 +++++++++++++++++++++++
>   1 files changed, 23 insertions(+), 0 deletions(-)
>   create mode 100644 src/gallium/auxiliary/util/u_dual_blend.h
>
> diff --git a/src/gallium/auxiliary/util/u_dual_blend.h b/src/gallium/auxiliary/util/u_dual_blend.h
> new file mode 100644
> index 0000000..5c2ddab
> --- /dev/null
> +++ b/src/gallium/auxiliary/util/u_dual_blend.h
> @@ -0,0 +1,23 @@
> +#ifndef U_DUAL_BLEND_H
> +#define U_DUAL_BLEND_H
> +
> +#include "pipe/p_state.h"
> +
> +#define util_is_dual_src_blend(x) (((x) == PIPE_BLENDFACTOR_SRC1_COLOR) || \
> +				   ((x) == PIPE_BLENDFACTOR_SRC1_ALPHA) || \
> +				   ((x) == PIPE_BLENDFACTOR_INV_SRC1_COLOR) || \
> +				   ((x) == PIPE_BLENDFACTOR_INV_SRC1_ALPHA))

Maybe make that macro into an inline function?


> +
> +static INLINE boolean util_blend_state_is_dual(const struct pipe_blend_state *blend,
> +				  int index)
> +{
> +   if (util_is_dual_src_blend(blend->rt[index].rgb_src_factor) ||
> +       util_is_dual_src_blend(blend->rt[index].alpha_src_factor) ||
> +       util_is_dual_src_blend(blend->rt[index].rgb_dst_factor) ||
> +       util_is_dual_src_blend(blend->rt[index].alpha_dst_factor))
> +      return true;
> +   return false;
> +}
> +
> +
> +#endif



More information about the mesa-dev mailing list