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_setup/ss_triangle.c | 14 +++++++++----- src/mesa/swrast_setup/ss_vb.c | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src/mesa/swrast_setup') diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c index b041c32ef5..d106d4c317 100644 --- a/src/mesa/swrast_setup/ss_triangle.c +++ b/src/mesa/swrast_setup/ss_triangle.c @@ -69,7 +69,7 @@ static void _swsetup_render_line_tri( GLcontext *ctx, return; } - if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (ctx->Light.ShadeModel == GL_FLAT) { COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); COPY_CHAN4(s[0], v0->specular); @@ -95,7 +95,7 @@ static void _swsetup_render_line_tri( GLcontext *ctx, if (ef[e2]) _swrast_Line( ctx, v2, v0 ); } - if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (ctx->Light.ShadeModel == GL_FLAT) { COPY_CHAN4(v0->color, c[0]); COPY_CHAN4(v1->color, c[1]); COPY_CHAN4(v0->specular, s[0]); @@ -128,7 +128,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx, return; } - if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (ctx->Light.ShadeModel == GL_FLAT) { + /* save colors/indexes for v0, v1 vertices */ COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); COPY_CHAN4(s[0], v0->specular); @@ -136,6 +137,7 @@ static void _swsetup_render_point_tri( GLcontext *ctx, i[0] = v0->index; i[1] = v1->index; + /* copy v2 color/indexes to v0, v1 indexes */ COPY_CHAN4(v0->color, v2->color); COPY_CHAN4(v1->color, v2->color); COPY_CHAN4(v0->specular, v2->specular); @@ -148,7 +150,8 @@ static void _swsetup_render_point_tri( GLcontext *ctx, if (ef[e1]) _swrast_Point( ctx, v1 ); if (ef[e2]) _swrast_Point( ctx, v2 ); - if (ctx->_TriangleCaps & DD_FLATSHADE) { + if (ctx->Light.ShadeModel == GL_FLAT) { + /* restore v0, v1 colores/indexes */ COPY_CHAN4(v0->color, c[0]); COPY_CHAN4(v1->color, c[1]); COPY_CHAN4(v0->specular, s[0]); @@ -294,7 +297,8 @@ void _swsetup_choose_trifuncs( GLcontext *ctx ) /* We piggyback the two-sided stencil front/back determination on the * unfilled triangle path. */ - if ((ctx->_TriangleCaps & DD_TRI_UNFILLED) || + if (ctx->Polygon.FrontMode != GL_FILL || + ctx->Polygon.BackMode != GL_FILL || (ctx->Stencil.Enabled && ctx->Stencil.TestTwoSide)) ind |= SS_UNFILLED_BIT; diff --git a/src/mesa/swrast_setup/ss_vb.c b/src/mesa/swrast_setup/ss_vb.c index fa4993434a..29bad8eefe 100644 --- a/src/mesa/swrast_setup/ss_vb.c +++ b/src/mesa/swrast_setup/ss_vb.c @@ -392,7 +392,7 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx) else if (ctx->Texture._EnabledCoordUnits == 1) funcindex |= TEX0; /* only unit 0 is enabled */ - if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) + if (NEED_SECONDARY_COLOR(ctx)) funcindex |= SPEC; } else { @@ -418,7 +418,9 @@ _swsetup_choose_rastersetup_func(GLcontext *ctx) swsetup->SetupIndex = funcindex; tnl->Driver.Render.BuildVertices = setup_tab[funcindex]; - if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) { + if (NEED_TWO_SIDED_LIGHTING(ctx) || + ctx->Polygon.FrontMode != GL_FILL || + ctx->Polygon.BackMode != GL_FILL) { tnl->Driver.Render.Interp = interp_extras; tnl->Driver.Render.CopyPV = copy_pv_extras; } -- cgit v1.2.3