summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2011-03-11 09:25:21 -0700
committerBrian Paul <brianp@vmware.com>2011-03-11 09:25:21 -0700
commitdecc6e2a32ef49e673c081f30e19b8970155d887 (patch)
tree463640956b098e3fd16af78694c2d48c07f23e95 /src/mesa/main
parent4293a12c7f0d4fd7ac3a278570f3fe55fc4433a6 (diff)
mesa: replace NEED_SECONDARY_COLOR(), RGBA_LOGICOP_ENABLED() with inlines
and rename them.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/context.h24
-rw-r--r--src/mesa/main/state.c6
-rw-r--r--src/mesa/main/state.h39
3 files changed, 42 insertions, 27 deletions
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 4e391dde49..33a36311c8 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -286,28 +286,4 @@ do { \
-/**
- * Is the secondary color needed?
- */
-#define NEED_SECONDARY_COLOR(CTX) \
- (((CTX)->Light.Enabled && \
- (CTX)->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR) \
- || (CTX)->Fog.ColorSumEnabled \
- || ((CTX)->VertexProgram._Current && \
- ((CTX)->VertexProgram._Current != (CTX)->VertexProgram._TnlProgram) && \
- ((CTX)->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1)) \
- || ((CTX)->FragmentProgram._Current && \
- ((CTX)->FragmentProgram._Current != (CTX)->FragmentProgram._TexEnvProgram) && \
- ((CTX)->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1)) \
- )
-
-
-/**
- * Is RGBA LogicOp enabled?
- */
-#define RGBA_LOGICOP_ENABLED(CTX) \
- ((CTX)->Color.ColorLogicOpEnabled || \
- ((CTX)->Color.BlendEnabled && (CTX)->Color.Blend[0].EquationRGB == GL_LOGIC_OP))
-
-
#endif /* CONTEXT_H */
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 502c429294..19c9bbabda 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -53,7 +53,7 @@
static void
update_separate_specular(struct gl_context *ctx)
{
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
else
ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
@@ -442,7 +442,7 @@ update_color(struct gl_context *ctx)
/* This is needed to support 1.1's RGB logic ops AND
* 1.0's blending logicops.
*/
- ctx->Color._LogicOpEnabled = RGBA_LOGICOP_ENABLED(ctx);
+ ctx->Color._LogicOpEnabled = _mesa_rgba_logicop_enabled(ctx);
}
@@ -524,7 +524,7 @@ update_tricaps(struct gl_context *ctx, GLbitfield new_state)
ctx->_TriangleCaps |= DD_TRI_LIGHT_TWOSIDE;
if (ctx->Light.ShadeModel == GL_FLAT)
ctx->_TriangleCaps |= DD_FLATSHADE;
- if (NEED_SECONDARY_COLOR(ctx))
+ if (_mesa_need_secondary_color(ctx))
ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
/*
diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h
index f0eb43d8ee..a48c777567 100644
--- a/src/mesa/main/state.h
+++ b/src/mesa/main/state.h
@@ -46,4 +46,43 @@ extern void
_mesa_set_vp_override(struct gl_context *ctx, GLboolean flag);
+/**
+ * Is the secondary color needed?
+ */
+static INLINE GLboolean
+_mesa_need_secondary_color(const struct gl_context *ctx)
+{
+ if (ctx->Light.Enabled &&
+ ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
+ return GL_TRUE;
+
+ if (ctx->Fog.ColorSumEnabled)
+ return GL_TRUE;
+
+ if (ctx->VertexProgram._Current &&
+ (ctx->VertexProgram._Current != ctx->VertexProgram._TnlProgram) &&
+ (ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1))
+ return GL_TRUE;
+
+ if (ctx->FragmentProgram._Current &&
+ (ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) &&
+ (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1))
+ return GL_TRUE;
+
+ return GL_FALSE;
+}
+
+
+/**
+ * Is RGBA LogicOp enabled?
+ */
+static INLINE GLboolean
+_mesa_rgba_logicop_enabled(const struct gl_context *ctx)
+{
+ return ctx->Color.ColorLogicOpEnabled ||
+ (ctx->Color.BlendEnabled && ctx->Color.Blend[0].EquationRGB == GL_LOGIC_OP);
+}
+
+
+
#endif