aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2012-03-24 14:28:03 +0000
committerDave Airlie <[email protected]>2012-04-13 17:19:02 +0100
commitc59d32d1ce9eee7bf0dcebfca1e69edbda90c22d (patch)
tree9b8d1cf6475db7f4b88b4dbfb0f4094b5b0453f8 /src/gallium
parenta21df965075f6fa1bf27039490ad65b9f78548e6 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_dual_blend.h26
1 files changed, 26 insertions, 0 deletions
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 00000000000..e31d43c18bd
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_dual_blend.h
@@ -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