1bf215546Sopenharmony_ci#ifndef U_DUAL_BLEND_H
2bf215546Sopenharmony_ci#define U_DUAL_BLEND_H
3bf215546Sopenharmony_ci
4bf215546Sopenharmony_ci#include "pipe/p_state.h"
5bf215546Sopenharmony_ci
6bf215546Sopenharmony_cistatic inline boolean util_blend_factor_is_dual_src(int factor)
7bf215546Sopenharmony_ci{
8bf215546Sopenharmony_ci   return (factor == PIPE_BLENDFACTOR_SRC1_COLOR) ||
9bf215546Sopenharmony_ci          (factor == PIPE_BLENDFACTOR_SRC1_ALPHA) ||
10bf215546Sopenharmony_ci          (factor == PIPE_BLENDFACTOR_INV_SRC1_COLOR) ||
11bf215546Sopenharmony_ci          (factor == PIPE_BLENDFACTOR_INV_SRC1_ALPHA);
12bf215546Sopenharmony_ci}
13bf215546Sopenharmony_ci
14bf215546Sopenharmony_cistatic inline boolean util_blend_state_is_dual(const struct pipe_blend_state *blend,
15bf215546Sopenharmony_ci				  int index)
16bf215546Sopenharmony_ci{
17bf215546Sopenharmony_ci   if (util_blend_factor_is_dual_src(blend->rt[index].rgb_src_factor) ||
18bf215546Sopenharmony_ci       util_blend_factor_is_dual_src(blend->rt[index].alpha_src_factor) ||
19bf215546Sopenharmony_ci       util_blend_factor_is_dual_src(blend->rt[index].rgb_dst_factor) ||
20bf215546Sopenharmony_ci       util_blend_factor_is_dual_src(blend->rt[index].alpha_dst_factor))
21bf215546Sopenharmony_ci      return true;
22bf215546Sopenharmony_ci   return false;
23bf215546Sopenharmony_ci}
24bf215546Sopenharmony_ci
25bf215546Sopenharmony_ci
26bf215546Sopenharmony_ci#endif
27