diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/tnl/t_context.h | 7 | ||||
-rw-r--r-- | src/mesa/tnl/t_save_api.c | 8 | ||||
-rw-r--r-- | src/mesa/tnl/t_save_playback.c | 4 | ||||
-rw-r--r-- | src/mesa/tnl/t_vtx_api.c | 27 |
4 files changed, 22 insertions, 24 deletions
diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 9d806da81fc..33c4e06985d 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -255,6 +255,7 @@ struct tnl_vtx { attrfv_func tabfv[_TNL_ATTRIB_MAX][4]; struct tnl_eval eval; GLboolean *edgeflag_tmp; + GLboolean have_materials; }; @@ -282,7 +283,8 @@ struct tnl_vertex_list { GLfloat *buffer; GLuint count; GLuint wrap_count; /* number of copied vertices at start */ - GLuint dangling_attr_ref; /* current attr implicitly referenced + GLboolean have_materials; /* bit of a hack - quick check for materials */ + GLboolean dangling_attr_ref; /* current attr implicitly referenced outside the list */ GLfloat *normal_lengths; @@ -333,7 +335,8 @@ struct tnl_save { GLfloat vertex[_TNL_ATTRIB_MAX*4]; /* current values */ GLfloat *attrptr[_TNL_ATTRIB_MAX]; GLuint counter, initial_counter; - GLuint dangling_attr_ref; + GLboolean dangling_attr_ref; + GLboolean have_materials; GLuint opcode_vertex_list; diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c index e95c1c98eb0..08a5036c6d1 100644 --- a/src/mesa/tnl/t_save_api.c +++ b/src/mesa/tnl/t_save_api.c @@ -475,7 +475,7 @@ static void _save_upgrade_vertex( GLcontext *ctx, */ if (tnl->save.currentsz[attr] == 0) { assert(oldsz == 0); - tnl->save.dangling_attr_ref = attr; + tnl->save.dangling_attr_ref = GL_TRUE; _mesa_debug(0, "_save_upgrade_vertex: dangling reference attr %d\n", attr); @@ -680,11 +680,12 @@ static void _save_reset_vertex( GLcontext *ctx ) save_init_13( tnl ); save_init_14( tnl ); save_init_15( tnl ); - + for (i = 0 ; i < _TNL_ATTRIB_MAX ; i++) tnl->save.attrsz[i] = 0; - + tnl->save.vertex_size = 0; + tnl->save.have_materials = 0; _save_reset_counters( ctx ); } @@ -989,6 +990,7 @@ static void GLAPIENTRY _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) do { \ if (tnl->save.attrsz[A] < N) { \ _save_upgrade_vertex( ctx, A, N ); \ + tnl->save.have_materials = GL_TRUE; \ } \ \ { \ diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c index 083901f079d..eaf30a3c181 100644 --- a/src/mesa/tnl/t_save_playback.c +++ b/src/mesa/tnl/t_save_playback.c @@ -149,6 +149,10 @@ static void _playback_copy_to_current( GLcontext *ctx, _mesa_update_color_material(ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } + if (node->have_materials) { + tnl->Driver.NotifyMaterialChange( ctx ); + } + /* CurrentExecPrimitive */ if (node->prim_count) { diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index 2fd5ccab1f3..482a316453c 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -132,7 +132,11 @@ static void _tnl_copy_to_current( GLcontext *ctx ) if (ctx->Light.ColorMaterialEnabled) { _mesa_update_color_material(ctx, ctx->Current.Attrib[VERT_ATTRIB_COLOR0]); } - + + if (tnl->vtx.have_materials) { + tnl->Driver.NotifyMaterialChange( ctx ); + } + ctx->Driver.NeedFlush &= ~FLUSH_UPDATE_CURRENT; } @@ -193,15 +197,12 @@ static void _tnl_wrap_upgrade_vertex( GLcontext *ctx, /* Heuristic: Attempt to isolate attributes received outside * begin/end so that they don't bloat the vertices. */ -#if 1 if (ctx->Driver.CurrentExecPrimitive == PRIM_OUTSIDE_BEGIN_END && tnl->vtx.attrsz[attr] == 0 && lastcount > 8 ) { init_attrfv( tnl ); } -#endif - /* Fix up sizes: */ @@ -430,13 +431,7 @@ ATTRS( 14 ) ATTRS( 15 ) static void init_attrfv( TNLcontext *tnl ) -{ -#if defined( WIN32 ) || defined( __VMS ) - if (0) fprintf(stderr, "%s %d\n", "init_attrfv", tnl->vtx.vertex_size); -#else - if (0) fprintf(stderr, "%s %d\n", __FUNCTION__, tnl->vtx.vertex_size); -#endif - +{ if (tnl->vtx.vertex_size) { GLuint i; @@ -461,6 +456,7 @@ static void init_attrfv( TNLcontext *tnl ) tnl->vtx.attrsz[i] = 0; tnl->vtx.vertex_size = 0; + tnl->vtx.have_materials = 0; } } @@ -762,6 +758,7 @@ static void GLAPIENTRY _tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) do { \ if (tnl->vtx.attrsz[A] != N) { \ _tnl_fixup_vertex( ctx, A, N ); \ + tnl->vtx.have_materials = GL_TRUE; \ } \ \ { \ @@ -984,13 +981,11 @@ static void GLAPIENTRY _tnl_Begin( GLenum mode ) return; } -#if 1 /* Heuristic: attempt to isolate attributes occuring outside * begin/end pairs. */ if (tnl->vtx.vertex_size && !tnl->vtx.attrsz[0]) _tnl_FlushVertices( ctx, ~0 ); -#endif i = tnl->vtx.prim_count++; tnl->vtx.prim[i].mode = mode | PRIM_BEGIN; @@ -1111,14 +1106,8 @@ void _tnl_FlushVertices( GLcontext *ctx, GLuint flags ) if (tnl->vtx.counter != tnl->vtx.initial_counter) { _tnl_flush_vtx( ctx ); -#if 0 - init_0(tnl); -#endif } -#if 0 - if (flags & FLUSH_UPDATE_CURRENT) -#endif { _tnl_copy_to_current( ctx ); |