Instead of testing ctx->_TriangleCaps for flat/smooth shading, just use ctx->Light.ShadeModel

This commit is contained in:
Brian Paul 2006-07-20 04:16:26 +00:00
parent 4e2de9531e
commit a1a6ac4af4
3 changed files with 26 additions and 23 deletions

View file

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.1
* Version: 6.5.1
*
* Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -26,7 +26,9 @@
*/
/* Template for render stages which build and emit vertices directly
/**
* \file t_dd_dmatmp.h
* Template for render stages which build and emit vertices directly
* to fixed-size dma buffers. Useful for rendering strips and other
* native primitives where clipping and per-vertex tweaks such as
* those in t_dd_tritmp.h are not required.
@ -400,7 +402,7 @@ static void TAG(render_poly_verts)( GLcontext *ctx,
FLUSH();
}
else if (HAVE_TRI_FANS && !(ctx->_TriangleCaps & DD_FLATSHADE)) {
else if (HAVE_TRI_FANS && ctx->Light.ShadeModel == GL_SMOOTH) {
TAG(render_tri_fan_verts)( ctx, start, count, flags );
} else {
fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__);
@ -440,7 +442,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
FLUSH();
} else if (HAVE_TRI_STRIPS &&
(ctx->_TriangleCaps & DD_FLATSHADE) &&
ctx->Light.ShadeModel == GL_FLAT &&
TNL_CONTEXT(ctx)->vb.ColorPtr[0]->stride) {
if (HAVE_ELTS) {
LOCAL_VARS;
@ -984,7 +986,7 @@ static void TAG(render_poly_elts)( GLcontext *ctx,
FLUSH();
currentsz = dmasz;
}
} else if (HAVE_TRI_FANS && !(ctx->_TriangleCaps & DD_FLATSHADE)) {
} else if (HAVE_TRI_FANS && Light.ShadeModel == GL_SMOOTH) {
TAG(render_tri_fan_verts)( ctx, start, count, flags );
} else {
fprintf(stderr, "%s - cannot draw primitive\n", __FUNCTION__);
@ -1018,7 +1020,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx,
if (currentsz < 12)
currentsz = dmasz;
if (ctx->_TriangleCaps & DD_FLATSHADE) {
if (ctx->Light.ShadeModel == GL_FLAT) {
ELT_INIT( GL_TRIANGLES );
currentsz = currentsz/6*2;
@ -1207,8 +1209,9 @@ static GLboolean TAG(validate_render)( GLcontext *ctx,
if (HAVE_POLYGONS) {
ok = GL_TRUE;
}
else
ok = (HAVE_TRI_FANS && !(ctx->_TriangleCaps & DD_FLATSHADE));
else {
ok = (HAVE_TRI_FANS && ctx->Light.ShadeModel == GL_SMOOTH);
}
break;
case GL_QUAD_STRIP:
if (VB->Elts) {
@ -1217,7 +1220,7 @@ static GLboolean TAG(validate_render)( GLcontext *ctx,
else if (HAVE_QUAD_STRIPS) {
ok = GL_TRUE;
} else if (HAVE_TRI_STRIPS &&
(ctx->_TriangleCaps & DD_FLATSHADE) &&
ctx->Light.ShadeModel == GL_FLAT &&
VB->ColorPtr[0]->stride != 0) {
if (HAVE_ELTS) {
ok = (GLint) count < GET_SUBSEQUENT_VB_MAX_ELTS();

View file

@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 4.0.3
* Version: 6.5.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -27,7 +26,9 @@
*/
/* Template for render stages which build and emit vertices directly
/**
* \file t_dd_dmatmp2.h
* Template for render stages which build and emit vertices directly
* to fixed-size dma buffers. Useful for rendering strips and other
* native primitives where clipping and per-vertex tweaks such as
* those in t_dd_tritmp.h are not required.
@ -422,7 +423,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
if (HAVE_QUAD_STRIPS) {
EMIT_PRIM( ctx, GL_QUAD_STRIP, HW_QUAD_STRIP, start, count );
}
else if (ctx->_TriangleCaps & DD_FLATSHADE) {
else if (ctx->Light.ShadeModel == GL_FLAT) {
LOCAL_VARS;
int dmasz = GET_MAX_HW_ELTS();
GLuint j, nr;
@ -810,7 +811,7 @@ static void TAG(render_quad_strip_elts)( GLcontext *ctx,
dmasz -= dmasz & 1;
count -= (count-start) & 1;
if (ctx->_TriangleCaps & DD_FLATSHADE) {
if (ctx->Light.ShadeModel == GL_FLAT) {
ELT_INIT( GL_TRIANGLES, HW_TRIANGLES );
dmasz = dmasz/6*2;

View file

@ -1,9 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 3.5
* Version: 6.5.1
*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -53,7 +52,7 @@ static void TAG(unfilled_tri)( GLcontext *ctx,
v[1] = (VERTEX *)GET_VERTEX(e1);
v[2] = (VERTEX *)GET_VERTEX(e2);
if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) {
if (ctx->Light.ShadeModel == GL_FLAT && HAVE_HW_FLATSHADE) {
if (HAVE_RGBA) {
VERT_SAVE_RGBA(0);
VERT_SAVE_RGBA(1);
@ -98,7 +97,7 @@ static void TAG(unfilled_tri)( GLcontext *ctx,
}
}
if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) {
if (ctx->Light.ShadeModel == GL_FLAT && HAVE_HW_FLATSHADE) {
if (HAVE_RGBA) {
VERT_RESTORE_RGBA(0);
VERT_RESTORE_RGBA(1);
@ -133,7 +132,7 @@ static void TAG(unfilled_quad)( GLcontext *ctx,
/* Hardware flatshading breaks down here. If the hardware doesn't
* support flatshading, this will already have been done:
*/
if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) {
if (ctx->Light.ShadeModel == GL_FLAT && HAVE_HW_FLATSHADE) {
if (HAVE_RGBA) {
VERT_SAVE_RGBA(0);
VERT_SAVE_RGBA(1);
@ -175,7 +174,7 @@ static void TAG(unfilled_quad)( GLcontext *ctx,
if (ef[e3]) LINE( v[3], v[0] );
}
if ((ctx->_TriangleCaps & DD_FLATSHADE) && HAVE_HW_FLATSHADE) {
if (ctx->Light.ShadeModel == GL_FLAT && HAVE_HW_FLATSHADE) {
if (HAVE_RGBA) {
VERT_RESTORE_RGBA(0);
VERT_RESTORE_RGBA(1);