Clean up install, restore for exec vtxfmts.
authorGareth Hughes <gareth@valinux.com>
Sun, 11 Mar 2001 23:49:20 +0000 (23:49 +0000)
committerGareth Hughes <gareth@valinux.com>
Sun, 11 Mar 2001 23:49:20 +0000 (23:49 +0000)
src/mesa/main/context.c
src/mesa/main/vtxfmt.c
src/mesa/main/vtxfmt.h
src/mesa/tnl/t_context.c

index cfd0fcb9270b81f8aaef434c8b153daa22e5fb31..f27535d9146285efde2792813456619558721c91 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.126 2001/03/11 18:49:11 gareth Exp $ */
+/* $Id: context.c,v 1.127 2001/03/11 23:49:20 gareth Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -1436,6 +1436,7 @@ _mesa_initialize_context( GLcontext *ctx,
    ctx->SavePrefersFloat = GL_FALSE;
 
    /* Neutral tnl module stuff */
+   _mesa_init_exec_vtxfmt( ctx );
    ctx->TnlModule.Current = NULL;
    ctx->TnlModule.SwapCount = 0;
 
index 22685e0f3765cc0cb6791c91c72b6299b502c096..d5660e8b54fddc403f0b5a60c2bf5cb53a9ec832 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: vtxfmt.c,v 1.2 2001/03/11 18:49:11 gareth Exp $ */
+/* $Id: vtxfmt.c,v 1.3 2001/03/11 23:49:20 gareth Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -149,28 +149,33 @@ static void install_vtxfmt( struct _glapi_table *tab, GLvertexformat *vfmt )
 }
 
 
-void _mesa_install_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt )
+void _mesa_init_exec_vtxfmt( GLcontext *ctx )
 {
-   ctx->TnlModule.Current = vfmt;
    install_vtxfmt( ctx->Exec, &neutral_vtxfmt );
-   if (ctx->ExecPrefersFloat != vfmt->prefer_float_colors)
+}
+
+void _mesa_install_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt )
+{
+   struct gl_tnl_module *tnl = &(ctx->TnlModule);
+
+   tnl->Current = vfmt;
+   _mesa_restore_exec_vtxfmt( ctx );
+   if ( ctx->ExecPrefersFloat != vfmt->prefer_float_colors )
       _mesa_loopback_prefer_float( ctx->Exec, vfmt->prefer_float_colors );
 }
 
 void _mesa_install_save_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt )
 {
    install_vtxfmt( ctx->Save, vfmt );
-   if (ctx->SavePrefersFloat != vfmt->prefer_float_colors)
+   if ( ctx->SavePrefersFloat != vfmt->prefer_float_colors )
       _mesa_loopback_prefer_float( ctx->Save, vfmt->prefer_float_colors );
 }
 
-void _mesa_restore_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt )
+void _mesa_restore_exec_vtxfmt( GLcontext *ctx )
 {
    struct gl_tnl_module *tnl = &(ctx->TnlModule);
    GLuint i;
 
-   tnl->Current = vfmt;
-
    /* Restore the neutral tnl module wrapper.
     */
    for ( i = 0 ; i < tnl->SwapCount ; i++ ) {
index af80ada7a4c3bcfd6bd52916ff7dce7a9377bde6..945457ebd731e94fcf25967b91e043db9d8627d4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: vtxfmt.h,v 1.2 2001/03/11 18:49:11 gareth Exp $ */
+/* $Id: vtxfmt.h,v 1.3 2001/03/11 23:49:20 gareth Exp $ */
 
 /*
  * Mesa 3-D graphics library
 #ifndef _VTXFMT_H_
 #define _VTXFMT_H_
 
+extern void _mesa_init_exec_vtxfmt( GLcontext *ctx );
+
 extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt );
 extern void _mesa_install_save_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt );
 
-extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx, GLvertexformat *vfmt );
+extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx );
 
 #endif
index 7e359bfd20fcc79f671e6365e1be3fc9199d6734..c533e8a7f466e99e8494bc73f859d18ce2eb6806 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: t_context.c,v 1.13 2001/03/11 18:49:11 gareth Exp $ */
+/* $Id: t_context.c,v 1.14 2001/03/11 23:49:20 gareth Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -174,7 +174,7 @@ _tnl_wakeup_exec( GLcontext *ctx )
 
    /* Hook our functions into exec and compile dispatch tables.
     */
-   _mesa_restore_exec_vtxfmt( ctx, &tnl->vtxfmt );
+   _mesa_install_exec_vtxfmt( ctx, &tnl->vtxfmt );
 
    /* Call all appropriate driver callbacks to revive state.
     */