From 29b4076f9acff96a867760fc885f5eaeb7586977 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 18 Sep 2003 23:21:08 +0000 Subject: Move away from using the ctx->_TriangleCaps bitfield. New macros in context.h for testing state: NEED_SECONDARY_COLOR and NEED_TWO_SIDED_LIGHTING. --- src/mesa/swrast/s_aatriangle.c | 2 +- src/mesa/swrast/s_context.c | 10 ++++------ src/mesa/swrast/s_lines.c | 3 ++- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index 21b8c0437e..7f2f3e338a 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -464,7 +464,7 @@ _swrast_set_aa_triangle_function(GLcontext *ctx) ASSERT(ctx->Polygon.SmoothFlag); if (ctx->Texture._EnabledCoordUnits != 0) { - if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) { + if (NEED_SECONDARY_COLOR(ctx)) { if (ctx->Texture._EnabledCoordUnits > 1) { SWRAST_CONTEXT(ctx)->Triangle = spec_multitex_aa_tri; } diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 9e429aef85..99da79afd5 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -226,8 +226,8 @@ _swrast_validate_triangle( GLcontext *ctx, _swrast_validate_derived( ctx ); swrast->choose_triangle( ctx ); - if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && - ctx->Texture._EnabledUnits == 0) { + if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx)) { + /* separate specular color, but no texture */ swrast->SpecTriangle = swrast->Triangle; swrast->Triangle = _swrast_add_spec_terms_triangle; } @@ -243,8 +243,7 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 ) _swrast_validate_derived( ctx ); swrast->choose_line( ctx ); - if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && - ctx->Texture._EnabledUnits == 0) { + if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx)) { swrast->SpecLine = swrast->Line; swrast->Line = _swrast_add_spec_terms_line; } @@ -261,8 +260,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 ) _swrast_validate_derived( ctx ); swrast->choose_point( ctx ); - if ((ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) && - ctx->Texture._EnabledUnits == 0) { + if (ctx->Texture._EnabledUnits == 0 && NEED_SECONDARY_COLOR(ctx)) { swrast->SpecPoint = swrast->Point; swrast->Point = _swrast_add_spec_terms_point; } diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index 97143a2f4b..f003395d42 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -24,6 +24,7 @@ #include "glheader.h" +#include "context.h" #include "colormac.h" #include "macros.h" #include "s_aaline.h" @@ -304,7 +305,7 @@ _swrast_choose_line( GLcontext *ctx ) else if (ctx->Texture._EnabledCoordUnits) { /* textured lines */ if (ctx->Texture._EnabledCoordUnits > 0x1 - || (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR)) { + || NEED_SECONDARY_COLOR(ctx)) { /* multi-texture and/or separate specular color */ USE(multitextured_line); } -- cgit v1.2.3