summaryrefslogtreecommitdiffstats
path: root/src/mesa/tnl/t_context.c
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2012-02-29 18:19:35 +0100
committerMathias Fröhlich <[email protected]>2012-02-29 20:37:28 +0100
commitba1d921bdf7a15fcc4a4e3162ea6fe9810f233d6 (patch)
tree2110e4a2df09ec86897d53a3343605d768a94a80 /src/mesa/tnl/t_context.c
parent8e5bc6dd1dab61858ae34ed76c7b2cc3e90b7ad5 (diff)
mesa: Push the shine table into the tnl module.
All users of the shine table outside of the tnl module are gone. Move the implementation into the tnl module and prefix the public functions with _tnl. Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Froehlich <[email protected]>
Diffstat (limited to 'src/mesa/tnl/t_context.c')
-rw-r--r--src/mesa/tnl/t_context.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c
index 1ded44ccffb..ede1d742835 100644
--- a/src/mesa/tnl/t_context.c
+++ b/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);