aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast_setup
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2003-09-18 23:21:08 +0000
committerBrian Paul <[email protected]>2003-09-18 23:21:08 +0000
commit29b4076f9acff96a867760fc885f5eaeb7586977 (patch)
tree8257664555bea58b6f9f2ebc4e3d0f2ddce719c3 /src/mesa/swrast_setup
parent1a8ebb8c2f939609004a13b75d2b85236e709716 (diff)
Move away from using the ctx->_TriangleCaps bitfield.
New macros in context.h for testing state: NEED_SECONDARY_COLOR and NEED_TWO_SIDED_LIGHTING.
Diffstat (limited to 'src/mesa/swrast_setup')
-rw-r--r--src/mesa/swrast_setup/ss_triangle.c14
-rw-r--r--src/mesa/swrast_setup/ss_vb.c6
2 files changed, 13 insertions, 7 deletions
diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c
index b041c32ef5c..d106d4c3173 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 fa4993434a0..29bad8eefea 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;
}