aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/tnl/t_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/tnl/t_context.c')
-rw-r--r--mesalib/src/mesa/tnl/t_context.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/mesalib/src/mesa/tnl/t_context.c b/mesalib/src/mesa/tnl/t_context.c
index 1ded44ccf..dbda7a5fc 100644
--- a/mesalib/src/mesa/tnl/t_context.c
+++ b/mesalib/src/mesa/tnl/t_context.c
@@ -46,6 +46,7 @@ GLboolean
_tnl_CreateContext( struct gl_context *ctx )
{
TNLcontext *tnl;
+ GLuint i;
/* Create the TNLcontext structure
*/
@@ -76,10 +77,21 @@ _tnl_CreateContext( struct gl_context *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;
+ tnl->Driver.NotifyMaterialChange = _tnl_validate_shine_tables;
tnl->nr_blocks = 0;
+ /* Lighting miscellaneous */
+ tnl->_ShineTabList = MALLOC_STRUCT( tnl_shine_tab );
+ make_empty_list( tnl->_ShineTabList );
+ /* Allocate 10 (arbitrary) shininess lookup tables */
+ for (i = 0 ; i < 10 ; i++) {
+ struct tnl_shine_tab *s = MALLOC_STRUCT( tnl_shine_tab );
+ s->shininess = -1;
+ s->refcount = 0;
+ insert_at_tail( tnl->_ShineTabList, s );
+ }
+
/* plug in the VBO drawing function */
vbo_set_draw_func(ctx, _tnl_vbo_draw_prims);
@@ -93,8 +105,15 @@ _tnl_CreateContext( struct gl_context *ctx )
void
_tnl_DestroyContext( struct gl_context *ctx )
{
+ struct tnl_shine_tab *s, *tmps;
TNLcontext *tnl = TNL_CONTEXT(ctx);
+ /* Free lighting shininess exponentiation table */
+ foreach_s( s, tmps, tnl->_ShineTabList ) {
+ free( s );
+ }
+ free( tnl->_ShineTabList );
+
_tnl_destroy_pipeline( ctx );
FREE(tnl);
@@ -151,8 +170,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
if (ctx->RenderMode == GL_FEEDBACK)
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX0);
- if (ctx->Point._Attenuated ||
- (ctx->VertexProgram._Enabled && ctx->VertexProgram.PointSizeEnabled))
+ if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled)
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_POINTSIZE);
/* check for varying vars which are written by the vertex program */