summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2002-02-13 00:53:19 +0000
committerKeith Whitwell <[email protected]>2002-02-13 00:53:19 +0000
commit0cb28418d06c30e431bdff515c1d36a812d5950d (patch)
tree4055885872891fb515f0acb780bf63a3a5fb02b8 /src/mesa/tnl
parent12a1024d9d003afe1212cc48af04dac81c034299 (diff)
More suport for t&l drivers
Fix GLuint compare bugs Fix RESET_STIPPLE calls
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_context.c20
-rw-r--r--src/mesa/tnl/t_context.h9
-rw-r--r--src/mesa/tnl/t_imm_api.c19
-rw-r--r--src/mesa/tnl/t_imm_dlist.c3
-rw-r--r--src/mesa/tnl/t_imm_exec.c10
-rw-r--r--src/mesa/tnl/t_imm_fixup.c21
-rw-r--r--src/mesa/tnl/t_vb_light.c4
-rw-r--r--src/mesa/tnl/t_vb_lighttmp.h12
-rw-r--r--src/mesa/tnl/t_vb_render.c6
-rw-r--r--src/mesa/tnl/t_vb_rendertmp.h39
-rw-r--r--src/mesa/tnl/tnl.h5
11 files changed, 97 insertions, 51 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index ae1d7f53611..2cea4b1dcdf 100644
--- a/src/mesa/tnl/t_context.c
+++ b/src/mesa/tnl/t_context.c
@@ -1,4 +1,4 @@
-/* $Id: t_context.c,v 1.23 2001/12/18 04:06:46 brianp Exp $ */
+/* $Id: t_context.c,v 1.24 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -33,6 +33,7 @@
#include "mtypes.h"
#include "mem.h"
#include "dlist.h"
+#include "light.h"
#include "vtxfmt.h"
#include "t_context.h"
@@ -125,6 +126,8 @@ _tnl_CreateContext( GLcontext *ctx )
tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts;
tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts;
+ tnl->Driver.NotifyMaterialChange = _mesa_validate_all_lighting_tables;
+
return GL_TRUE;
@@ -220,16 +223,19 @@ void
_tnl_need_dlist_loopback( GLcontext *ctx, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- if (tnl->LoopbackDListCassettes != mode) {
- tnl->LoopbackDListCassettes = mode;
- }
+ tnl->LoopbackDListCassettes = mode;
}
void
_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean mode )
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- if (tnl->CalcDListNormalLengths != mode) {
- tnl->CalcDListNormalLengths = mode;
- }
+ tnl->CalcDListNormalLengths = mode;
+}
+
+void
+_tnl_isolate_materials( GLcontext *ctx, GLboolean mode )
+{
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ tnl->IsolateMaterials = mode;
}
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h
index db0bd7a4748..98ff5456048 100644
--- a/src/mesa/tnl/t_context.h
+++ b/src/mesa/tnl/t_context.h
@@ -1,4 +1,4 @@
-/* $Id: t_context.h,v 1.37 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_context.h,v 1.38 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -386,6 +386,12 @@ struct tnl_device_driver {
* and grab/release hardware locks.
*/
+ void (*NotifyMaterialChange)(GLcontext *ctx);
+ /* Alert tnl-aware drivers of changes to material, especially in
+ * exec_empty_cassette, which doesn't otherwise reach the driver.
+ * --> Need to be able to disable exec_empty_cassette???
+ */
+
/***
*** Rendering -- These functions called only from t_vb_render.c
***/
@@ -524,6 +530,7 @@ typedef struct {
GLboolean NeedNdcCoords;
GLboolean LoopbackDListCassettes;
GLboolean CalcDListNormalLengths;
+ GLboolean IsolateMaterials;
/* Derived state and storage for _tnl_eval_vb:
*/
diff --git a/src/mesa/tnl/t_imm_api.c b/src/mesa/tnl/t_imm_api.c
index dd90dbe5403..d19f6a6e007 100644
--- a/src/mesa/tnl/t_imm_api.c
+++ b/src/mesa/tnl/t_imm_api.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_api.c,v 1.24 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_api.c,v 1.25 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -553,6 +553,8 @@ static void
_tnl_Normal3fv( const GLfloat *v )
{
NORMALF( v[0], v[1], v[2] );
+/* struct immediate *IM = (struct immediate *)(((GLcontext *) _glapi_Context)->swtnl_im); */
+/* IM->Flag[IM->Count] = VERT_NORM; */
}
@@ -1154,6 +1156,7 @@ static void
_tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
{
GET_CURRENT_CONTEXT(ctx);
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
struct immediate *IM = TNL_CURRENT_IM(ctx);
GLuint count = IM->Count;
struct gl_material *mat;
@@ -1162,6 +1165,14 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
if (bitmask == 0)
return;
+ if (tnl->IsolateMaterials &&
+ !(IM->BeginState & VERT_BEGIN_1)) /* heuristic */
+ {
+ _tnl_flush_immediate( IM );
+ IM = TNL_CURRENT_IM(ctx);
+ count = IM->Count;
+ }
+
if (!(IM->Flag[count] & VERT_BIT_MATERIAL)) {
if (!IM->Material) {
IM->Material = (struct gl_material (*)[2])
@@ -1227,6 +1238,12 @@ _tnl_Materialfv( GLenum face, GLenum pname, const GLfloat *params )
mat[1].DiffuseIndex = params[1];
mat[1].SpecularIndex = params[2];
}
+
+ if (tnl->IsolateMaterials &&
+ !(IM->BeginState & VERT_BEGIN_1)) /* heuristic */
+ {
+ _tnl_flush_immediate( IM );
+ }
}
void _tnl_imm_vtxfmt_init( GLcontext *ctx )
diff --git a/src/mesa/tnl/t_imm_dlist.c b/src/mesa/tnl/t_imm_dlist.c
index 125dbc5ed65..dfc4e7795d1 100644
--- a/src/mesa/tnl/t_imm_dlist.c
+++ b/src/mesa/tnl/t_imm_dlist.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_dlist.c,v 1.37 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_dlist.c,v 1.38 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -339,6 +339,7 @@ execute_compiled_cassette( GLcontext *ctx, void *data )
}
if (tnl->LoopbackDListCassettes) {
+/* (tnl->IsolateMaterials && (IM->OrFlag & VERT_MATERIAL)) ) { */
fixup_compiled_primitives( ctx, IM );
loopback_compiled_cassette( ctx, IM );
restore_compiled_primitives( ctx, IM );
diff --git a/src/mesa/tnl/t_imm_exec.c b/src/mesa/tnl/t_imm_exec.c
index 056df78d0a1..bc35480acca 100644
--- a/src/mesa/tnl/t_imm_exec.c
+++ b/src/mesa/tnl/t_imm_exec.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_exec.c,v 1.35 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_exec.c,v 1.36 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -149,7 +149,7 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
if (ctx->Light.ColorMaterialEnabled) {
_mesa_update_color_material( ctx,
ctx->Current.Attrib[VERT_ATTRIB_COLOR0] );
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
}
}
@@ -175,7 +175,7 @@ void _tnl_copy_to_current( GLcontext *ctx, struct immediate *IM,
IM->Material[IM->LastMaterial],
IM->MaterialOrMask );
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
}
}
@@ -356,7 +356,7 @@ static void _tnl_vb_bind_immediate( GLcontext *ctx, struct immediate *IM )
}
}
- if ((inputs & VERT_BIT_MATERIAL) && IM->Material) {
+ if ((inputs & IM->OrFlag & VERT_BIT_MATERIAL) && IM->Material) {
VB->MaterialMask = IM->MaterialMask + start;
VB->Material = IM->Material + start;
}
@@ -482,7 +482,7 @@ void _tnl_execute_cassette( GLcontext *ctx, struct immediate *IM )
if (tnl->pipeline.build_state_changes)
_tnl_validate_pipeline( ctx );
- if (IM->CopyStart == IM->Count) {
+ if (0 && IM->CopyStart == IM->Count) {
exec_empty_cassette( ctx, IM );
}
else if ((IM->CopyOrFlag & VERT_BITS_DATA) == VERT_BIT_ELT &&
diff --git a/src/mesa/tnl/t_imm_fixup.c b/src/mesa/tnl/t_imm_fixup.c
index d08c162efef..8e3f52e6210 100644
--- a/src/mesa/tnl/t_imm_fixup.c
+++ b/src/mesa/tnl/t_imm_fixup.c
@@ -1,4 +1,4 @@
-/* $Id: t_imm_fixup.c,v 1.33 2002/01/22 14:35:16 brianp Exp $ */
+/* $Id: t_imm_fixup.c,v 1.34 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -396,6 +396,8 @@ copy_material( struct immediate *next,
struct immediate *prev,
GLuint dst, GLuint src )
{
+/* fprintf(stderr, "%s\n", __FUNCTION__); */
+
if (next->Material == 0) {
next->Material = (struct gl_material (*)[2])
MALLOC( sizeof(struct gl_material) * IMM_SIZE * 2 );
@@ -461,6 +463,7 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
GLuint dst = next->CopyStart+i;
next->Elt[dst] = prev->Elt[src];
next->Flag[dst] = VERT_BIT_ELT;
+ elts[i+offset] = dst;
}
/* fprintf(stderr, "ADDING VERT_BIT_ELT!\n"); */
next->CopyOrFlag |= VERT_BIT_ELT;
@@ -551,14 +554,14 @@ void _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
next->CopyOrFlag |= prev->Flag[src] & (VERT_BITS_FIXUP|
VERT_BIT_MATERIAL|
VERT_BIT_POS);
+ elts[i+offset] = dst;
}
}
- if (--tnl->ExecCopySource->ref_count == 0)
+ if (--tnl->ExecCopySource->ref_count == 0)
_tnl_free_immediate( tnl->ExecCopySource );
-
- tnl->ExecCopySource = 0;
- tnl->ExecCopyCount = 0;
+
+ tnl->ExecCopySource = next; next->ref_count++;
}
@@ -766,17 +769,19 @@ _tnl_get_exec_copy_verts( GLcontext *ctx, struct immediate *IM )
/* fprintf(stderr, "_tnl_get_exec_copy_verts %s\n", */
/* _mesa_lookup_enum_by_nr(prim)); */
- ASSERT(tnl->ExecCopySource == 0);
+ if (tnl->ExecCopySource)
+ if (--tnl->ExecCopySource->ref_count == 0)
+ _tnl_free_immediate( tnl->ExecCopySource );
if (prim == GL_POLYGON+1) {
+ tnl->ExecCopySource = 0;
tnl->ExecCopyCount = 0;
tnl->ExecCopyTexSize = 0;
tnl->ExecParity = 0;
} else {
/* Remember this immediate as the one to copy from.
*/
- IM->ref_count++;
- tnl->ExecCopySource = IM;
+ tnl->ExecCopySource = IM; IM->ref_count++;
tnl->ExecCopyCount = 0;
tnl->ExecCopyTexSize = IM->CopyTexSize;
diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c
index 32444ee3aa6..99f15d8036b 100644
--- a/src/mesa/tnl/t_vb_light.c
+++ b/src/mesa/tnl/t_vb_light.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_light.c,v 1.17 2002/01/22 14:35:17 brianp Exp $ */
+/* $Id: t_vb_light.c,v 1.18 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -232,7 +232,7 @@ static GLboolean run_validate_lighting( GLcontext *ctx,
/* This and the above should only be done on _NEW_LIGHT:
*/
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
/* Now run the stage...
*/
diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h
index ef25cd69bc8..aac8890180b 100644
--- a/src/mesa/tnl/t_vb_lighttmp.h
+++ b/src/mesa/tnl/t_vb_lighttmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_lighttmp.h,v 1.24 2002/01/22 14:35:17 brianp Exp $ */
+/* $Id: t_vb_lighttmp.h,v 1.25 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -163,7 +163,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) ) {
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
@@ -375,7 +375,7 @@ static void TAG(light_rgba)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) ) {
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1], ctx->Light.Material[1].Diffuse[3]);
@@ -576,7 +576,7 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) )
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
/* No attenuation, so incoporate _MatAmbient into base color.
@@ -708,7 +708,7 @@ static void TAG(light_fast_rgba)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) ) {
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
UNCLAMPED_FLOAT_TO_CHAN(sumA[0], ctx->Light.Material[0].Diffuse[3]);
if (IDX & LIGHT_TWOSIDE)
UNCLAMPED_FLOAT_TO_CHAN(sumA[1],
@@ -853,7 +853,7 @@ static void TAG(light_ci)( GLcontext *ctx,
_mesa_update_material( ctx, new_material[j], new_material_mask[j] );
if ( CHECK_VALIDATE(j) )
- _mesa_validate_all_lighting_tables( ctx );
+ TNL_CONTEXT(ctx)->Driver.NotifyMaterialChange( ctx );
diffuse[0] = specular[0] = 0.0F;
diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c
index 5ccec25cb28..1721b883235 100644
--- a/src/mesa/tnl/t_vb_render.c
+++ b/src/mesa/tnl/t_vb_render.c
@@ -1,4 +1,4 @@
-/* $Id: t_vb_render.c,v 1.27 2002/01/22 14:35:17 brianp Exp $ */
+/* $Id: t_vb_render.c,v 1.28 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -142,7 +142,7 @@ do { \
#define TAG(x) clip_##x##_verts
#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
+#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define PRESERVE_VB_DEFS
#include "t_vb_rendertmp.h"
@@ -229,7 +229,7 @@ static void clip_elt_triangles( GLcontext *ctx,
(void) (LineFunc && TriangleFunc && QuadFunc); \
(void) elt; (void) stipple
-#define RESET_STIPPLE tnl->Driver.Render.ResetLineStipple( ctx )
+#define RESET_STIPPLE if (stipple) tnl->Driver.Render.ResetLineStipple( ctx )
#define RESET_OCCLUSION ctx->OcclusionResult = GL_TRUE
#define INIT(x) tnl->Driver.Render.PrimitiveNotify( ctx, x )
#define RENDER_TAB_QUALIFIER
diff --git a/src/mesa/tnl/t_vb_rendertmp.h b/src/mesa/tnl/t_vb_rendertmp.h
index 7e9f6842c70..16528db6ad1 100644
--- a/src/mesa/tnl/t_vb_rendertmp.h
+++ b/src/mesa/tnl/t_vb_rendertmp.h
@@ -1,4 +1,4 @@
-/* $Id: t_vb_rendertmp.h,v 1.8 2001/03/12 00:48:44 gareth Exp $ */
+/* $Id: t_vb_rendertmp.h,v 1.9 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -90,8 +90,8 @@ static void TAG(render_lines)( GLcontext *ctx,
RESET_OCCLUSION;
INIT(GL_LINES);
for (j=start+1; j<count; j+=2 ) {
- RENDER_LINE( ELT(j-1), ELT(j) );
RESET_STIPPLE;
+ RENDER_LINE( ELT(j-1), ELT(j) );
}
POSTFIX;
}
@@ -109,12 +109,13 @@ static void TAG(render_line_strip)( GLcontext *ctx,
RESET_OCCLUSION;
INIT(GL_LINE_STRIP);
+ if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
+ }
+
for (j=start+1; j<count; j++ )
RENDER_LINE( ELT(j-1), ELT(j) );
- if (TEST_PRIM_END(flags))
- RESET_STIPPLE;
-
POSTFIX;
}
@@ -134,6 +135,7 @@ static void TAG(render_line_loop)( GLcontext *ctx,
if (start+1 < count) {
if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
RENDER_LINE( ELT(start), ELT(start+1) );
}
@@ -143,7 +145,6 @@ static void TAG(render_line_loop)( GLcontext *ctx,
if ( TEST_PRIM_END(flags)) {
RENDER_LINE( ELT(count-1), ELT(start) );
- RESET_STIPPLE;
}
}
@@ -165,8 +166,8 @@ static void TAG(render_triangles)( GLcontext *ctx,
for (j=start+2; j<count; j+=3) {
/* Leave the edgeflags as supplied by the user.
*/
- RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) );
RESET_STIPPLE;
+ RENDER_TRI( ELT(j-2), ELT(j-1), ELT(j) );
}
} else {
for (j=start+2; j<count; j+=3) {
@@ -199,6 +200,9 @@ static void TAG(render_tri_strip)( GLcontext *ctx,
GLboolean ef2 = EDGEFLAG_GET( ej2 );
GLboolean ef1 = EDGEFLAG_GET( ej1 );
GLboolean ef = EDGEFLAG_GET( ej );
+ if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
+ }
EDGEFLAG_SET( ej2, GL_TRUE );
EDGEFLAG_SET( ej1, GL_TRUE );
EDGEFLAG_SET( ej, GL_TRUE );
@@ -206,7 +210,6 @@ static void TAG(render_tri_strip)( GLcontext *ctx,
EDGEFLAG_SET( ej2, ef2 );
EDGEFLAG_SET( ej1, ef1 );
EDGEFLAG_SET( ej, ef );
- RESET_STIPPLE;
}
} else {
for (j=start+2; j<count ; j++, parity^=1) {
@@ -237,6 +240,9 @@ static void TAG(render_tri_fan)( GLcontext *ctx,
GLboolean efs = EDGEFLAG_GET( ejs );
GLboolean ef1 = EDGEFLAG_GET( ej1 );
GLboolean ef = EDGEFLAG_GET( ej );
+ if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
+ }
EDGEFLAG_SET( ejs, GL_TRUE );
EDGEFLAG_SET( ej1, GL_TRUE );
EDGEFLAG_SET( ej, GL_TRUE );
@@ -244,7 +250,6 @@ static void TAG(render_tri_fan)( GLcontext *ctx,
EDGEFLAG_SET( ejs, efs );
EDGEFLAG_SET( ej1, ef1 );
EDGEFLAG_SET( ej, ef );
- RESET_STIPPLE;
}
} else {
for (j=start+2;j<count;j++) {
@@ -275,6 +280,9 @@ static void TAG(render_poly)( GLcontext *ctx,
*/
if (!TEST_PRIM_BEGIN(flags))
EDGEFLAG_SET( ELT(start), GL_FALSE );
+ else {
+ RESET_STIPPLE;
+ }
/* If the primitive does not end here, the final edge is
* non-boundary.
@@ -284,7 +292,7 @@ static void TAG(render_poly)( GLcontext *ctx,
/* Draw the first triangles (possibly zero)
*/
- if (j<count-1) {
+ if (j+1<count) {
GLboolean ef = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE );
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) );
@@ -295,7 +303,7 @@ static void TAG(render_poly)( GLcontext *ctx,
*/
EDGEFLAG_SET( ELT(start), GL_FALSE );
- for (;j<count-1;j++) {
+ for (;j+1<count;j++) {
GLboolean efj = EDGEFLAG_GET( ELT(j) );
EDGEFLAG_SET( ELT(j), GL_FALSE );
RENDER_TRI( ELT(j-1), ELT(j), ELT(start) );
@@ -313,9 +321,6 @@ static void TAG(render_poly)( GLcontext *ctx,
EDGEFLAG_SET( ELT(count-1), efcount );
EDGEFLAG_SET( ELT(start), efstart );
- if (TEST_PRIM_END(flags)) {
- RESET_STIPPLE;
- }
}
else {
for (j=start+2;j<count;j++) {
@@ -339,8 +344,8 @@ static void TAG(render_quads)( GLcontext *ctx,
for (j=start+3; j<count; j+=4) {
/* Use user-specified edgeflags for quads.
*/
- RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) );
RESET_STIPPLE;
+ RENDER_QUAD( ELT(j-3), ELT(j-2), ELT(j-1), ELT(j) );
}
} else {
for (j=start+3; j<count; j+=4) {
@@ -369,6 +374,9 @@ static void TAG(render_quad_strip)( GLcontext *ctx,
GLboolean ef2 = EDGEFLAG_GET( ELT(j-2) );
GLboolean ef1 = EDGEFLAG_GET( ELT(j-1) );
GLboolean ef = EDGEFLAG_GET( ELT(j) );
+ if (TEST_PRIM_BEGIN(flags)) {
+ RESET_STIPPLE;
+ }
EDGEFLAG_SET( ELT(j-3), GL_TRUE );
EDGEFLAG_SET( ELT(j-2), GL_TRUE );
EDGEFLAG_SET( ELT(j-1), GL_TRUE );
@@ -378,7 +386,6 @@ static void TAG(render_quad_strip)( GLcontext *ctx,
EDGEFLAG_SET( ELT(j-2), ef2 );
EDGEFLAG_SET( ELT(j-1), ef1 );
EDGEFLAG_SET( ELT(j), ef );
- RESET_STIPPLE;
}
} else {
for (j=start+3;j<count;j+=2) {
diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h
index 16470295f48..c3c3ad7adb0 100644
--- a/src/mesa/tnl/tnl.h
+++ b/src/mesa/tnl/tnl.h
@@ -1,4 +1,4 @@
-/* $Id: tnl.h,v 1.8 2001/06/28 17:34:14 keithw Exp $ */
+/* $Id: tnl.h,v 1.9 2002/02/13 00:53:20 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -72,4 +72,7 @@ _tnl_need_dlist_loopback( GLcontext *ctx, GLboolean flag );
extern void
_tnl_need_dlist_norm_lengths( GLcontext *ctx, GLboolean flag );
+extern void
+_tnl_isolate_materials( GLcontext *ctx, GLboolean flag );
+
#endif