[Mesa-dev] [PATCH 5/7] util: add dual blend helper function
Dave Airlie
airlied at gmail.com
Tue Apr 3 06:16:55 PDT 2012
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))
+
+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
--
1.7.7.6
More information about the mesa-dev
mailing list