summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2010-01-26 15:35:31 +0100
committerRoland Scheidegger <sroland@vmware.com>2010-01-26 15:35:31 +0100
commit9bc80ff17496feda3b47cf40e577976237f87957 (patch)
tree1b4c023187eca64f379ae04bdf7ebd279a5133db /src/mesa/state_tracker
parentdf4395198ce433251c8bd2d497543c7b389e5aca (diff)
mesa/st: code cleanups for new blend functionality
minor code changes, style and comment fixes
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_atom_blend.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c
index 809b10d479..1511b88dd1 100644
--- a/src/mesa/state_tracker/st_atom_blend.c
+++ b/src/mesa/state_tracker/st_atom_blend.c
@@ -152,17 +152,33 @@ translate_logicop(GLenum logicop)
}
}
-static boolean
-colormask_perrt(GLcontext *ctx)
+/**
+ * Figure out if colormasks are different per rt.
+ */
+static GLboolean
+colormask_per_rt(GLcontext *ctx)
{
- /* XXX this is ugly beyond belief */
+ /* a bit suboptimal have to compare lots of values */
unsigned i;
for (i = 1; i < ctx->Const.MaxDrawBuffers; i++) {
- if (!TEST_EQ_4V(ctx->Color.ColorMask[0], ctx->Color.ColorMask[i])) {
- return true;
+ if (memcmp(ctx->Color.ColorMask[0], ctx->Color.ColorMask[i], 4)) {
+ return GL_TRUE;
}
}
- return false;
+ return GL_FALSE;
+}
+
+/**
+ * Figure out if blend enables are different per rt.
+ */
+static GLboolean
+blend_per_rt(GLcontext *ctx)
+{
+ if (ctx->Color.BlendEnabled &&
+ (ctx->Color.BlendEnabled != ((1 << ctx->Const.MaxDrawBuffers) - 1))) {
+ return GL_TRUE;
+ }
+ return GL_FALSE;
}
static void
@@ -174,9 +190,7 @@ update_blend( struct st_context *st )
memset(blend, 0, sizeof(*blend));
- if ((st->ctx->Color.BlendEnabled &&
- (st->ctx->Color.BlendEnabled != ((1 << st->ctx->Const.MaxDrawBuffers) - 1))) ||
- colormask_perrt(st->ctx)) {
+ if (blend_per_rt(st->ctx) || colormask_per_rt(st->ctx)) {
num_state = st->ctx->Const.MaxDrawBuffers;
blend->independent_blend_enable = 1;
}