Lift VBO/tnl stuff up out of drivers
authorBrian <brian.paul@tungstengraphics.com>
Wed, 31 Oct 2007 17:35:50 +0000 (11:35 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Wed, 31 Oct 2007 17:35:50 +0000 (11:35 -0600)
src/mesa/drivers/dri/intel_winsys/intel_context.c
src/mesa/drivers/x11/xm_api.c
src/mesa/state_tracker/st_context.c

index 975085b16810b9e3d5273e54a158bff571b645ac..790f67b55202e26e8f1821a202ed88eab56ad591 100644 (file)
 #include "context.h"
 #include "extensions.h"
 
-#include "tnl/tnl.h"
-#include "tnl/t_pipeline.h"
-#include "tnl/t_vertex.h"
-
 #include "drivers/common/driverfuncs.h"
 
 #include "i830_dri.h"
@@ -210,11 +206,6 @@ intelCreateContext(const __GLcontextModes * mesaVis,
                        intel->driScreen->myNum, "i915");
 
 
-   /* Initialize the software rasterizer and helper modules. */
-   _vbo_CreateContext(ctx);
-   _tnl_CreateContext(ctx);
-
-
    /*
     * memory pools
     */
@@ -230,9 +221,6 @@ intelCreateContext(const __GLcontextModes * mesaVis,
    intel->driFd = sPriv->fd;
    intel->driHwLock = (drmLock *) & sPriv->pSAREA->lock;
 
-   TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
-
-
    fthrottle_mode = driQueryOptioni(&intel->optionCache, "fthrottle_mode");
    intel->iw.irq_seq = -1;
    intel->irqsEmitted = 0;
@@ -309,8 +297,6 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
       //intel->vtbl.destroy(intel);
 
       release_texture_heaps = (intel->ctx.Shared->RefCount == 1);
-      _tnl_DestroyContext(&intel->ctx);
-      _vbo_DestroyContext(&intel->ctx);
 
       intel_batchbuffer_free(intel->batch);
 
@@ -332,8 +318,10 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv)
           */
       }
 
-      /* free the Mesa context */
+      /* free the Mesa context data */
       _mesa_free_context_data(&intel->ctx);
+
+      st_destroy_context(intel->ctx.st);
    }
 }
 
index 4b31447bbd56e862d1bb54eb5c495ee424ead367..ffe8361d2684d64434bc3f23853deac7ec424498 100644 (file)
 #include "swrast/swrast.h"
 #include "swrast_setup/swrast_setup.h"
 #include "vbo/vbo.h"
+#if 0
 #include "tnl/tnl.h"
 #include "tnl/t_context.h"
 #include "tnl/t_pipeline.h"
+#endif
 #include "drivers/common/driverfuncs.h"
 
 #include "state_tracker/st_public.h"
@@ -1528,7 +1530,9 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
    XMesaContext c;
    GLcontext *mesaCtx;
    struct dd_function_table functions;
+#if 0
    TNLcontext *tnl;
+#endif
 
    if (firstTime) {
       _glthread_INIT_MUTEX(_xmesa_lock);
@@ -1591,17 +1595,22 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
    /* Initialize the software rasterizer and helper modules.
     */
    if (!_swrast_CreateContext( mesaCtx ) ||
+#if 0
        !_vbo_CreateContext( mesaCtx ) ||
        !_tnl_CreateContext( mesaCtx ) ||
+#endif
        !_swsetup_CreateContext( mesaCtx )) {
       _mesa_free_context_data(&c->mesa);
       _mesa_free(c);
       return NULL;
    }
 
+#if 0
    /* tnl setup */
    tnl = TNL_CONTEXT(mesaCtx);
    tnl->Driver.RunPipeline = _tnl_run_pipeline;
+#endif
+
    /* swrast setup */
    xmesa_register_swrast_functions( mesaCtx );
    _swsetup_Wakeup(mesaCtx);
@@ -1641,8 +1650,10 @@ void XMesaDestroyContext( XMesaContext c )
 
    _swsetup_DestroyContext( mesaCtx );
    _swrast_DestroyContext( mesaCtx );
+#if 0
    _tnl_DestroyContext( mesaCtx );
    _vbo_DestroyContext( mesaCtx );
+#endif
    _mesa_free_context_data( mesaCtx );
    _mesa_free( c );
 }
index 95c5eec26e003dc24bc44d743fee8133dea07cef..97e178bbe135c822111ee53c5c53eb8be9ce2df6 100644 (file)
@@ -78,6 +78,11 @@ struct st_context *st_create_context( GLcontext *ctx,
    st->ctx = ctx;
    st->pipe = pipe;
 
+   /* state tracker needs the VBO module */
+   _vbo_CreateContext(ctx);
+   /* XXX temporary */
+   _tnl_CreateContext(ctx);
+
    st->draw = draw_create(); /* for selection/feedback */
 
    st->dirty.mesa = ~0;
@@ -125,6 +130,9 @@ void st_destroy_context( struct st_context *st )
    st_destroy_atoms( st );
    st_destroy_draw( st );
 
+   _vbo_DestroyContext(st->ctx);
+   _tnl_DestroyContext(st->ctx); /* XXX temporary */
+
 #if 0
    st_destroy_cb_clear( st );
    st_destroy_cb_program( st );