On 04/03/2012 07:16 AM, Dave Airlie wrote:
From: Dave Airlie<airl...@redhat.com>
This is just a function to tell if a certain blend mode requires dual sources.
Signed-off-by: Dave Airlie<airl...@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
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev