mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 15:30:14 +01:00
util: add dual blend helper function (v2)
This is just a function to tell if a certain blend mode requires dual sources. v2: move to inlines as per Brian's suggestion Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
a21df96507
commit
c59d32d1ce
1 changed files with 26 additions and 0 deletions
26
src/gallium/auxiliary/util/u_dual_blend.h
Normal file
26
src/gallium/auxiliary/util/u_dual_blend.h
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef U_DUAL_BLEND_H
|
||||||
|
#define U_DUAL_BLEND_H
|
||||||
|
|
||||||
|
#include "pipe/p_state.h"
|
||||||
|
|
||||||
|
static INLINE boolean util_blend_factor_is_dual_src(int factor)
|
||||||
|
{
|
||||||
|
return (factor == PIPE_BLENDFACTOR_SRC1_COLOR) ||
|
||||||
|
(factor == PIPE_BLENDFACTOR_SRC1_ALPHA) ||
|
||||||
|
(factor == PIPE_BLENDFACTOR_INV_SRC1_COLOR) ||
|
||||||
|
(factor == PIPE_BLENDFACTOR_INV_SRC1_ALPHA);
|
||||||
|
}
|
||||||
|
|
||||||
|
static INLINE boolean util_blend_state_is_dual(const struct pipe_blend_state *blend,
|
||||||
|
int index)
|
||||||
|
{
|
||||||
|
if (util_blend_factor_is_dual_src(blend->rt[index].rgb_src_factor) ||
|
||||||
|
util_blend_factor_is_dual_src(blend->rt[index].alpha_src_factor) ||
|
||||||
|
util_blend_factor_is_dual_src(blend->rt[index].rgb_dst_factor) ||
|
||||||
|
util_blend_factor_is_dual_src(blend->rt[index].alpha_dst_factor))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Add table
Reference in a new issue