From d3fd7ba8af15bead2f770d68a893449adeb11397 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 20 Jan 2004 02:49:27 +0000 Subject: Before calling _mesa_create_context(), initialize a dd_function_table struct by calling _mesa_init_driver_functions() and then plugging in the driver- specific functions. In particular, make sure ctx->Driver.NewTextureObject points to the appropriate driver function so that _all_ texture objects are augmented with the driver-specific data. Put in a bunch of assertions in the texture-related driver functions that texObj->DriverData is valid. Remove old dead code in near future. --- src/mesa/drivers/dri/tdfx/tdfx_context.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/mesa/drivers/dri/tdfx/tdfx_context.c') diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index ae79c55b39..973aa6cff2 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -40,13 +40,13 @@ #include "tdfx_dd.h" #include "tdfx_state.h" #include "tdfx_vb.h" +#include "tdfx_tex.h" #include "tdfx_tris.h" #include "tdfx_render.h" #include "tdfx_span.h" #include "tdfx_texman.h" #include "extensions.h" - #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" #include "array_cache/acache.h" @@ -54,6 +54,8 @@ #include "tnl/tnl.h" #include "tnl/t_pipeline.h" +#include "drivers/common/driverfuncs.h" + const char __driConfigOptions[] = { 0 }; const GLuint __driNConfigOptions = 0; @@ -115,19 +117,29 @@ GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis, tdfxScreenPrivate *fxScreen = (tdfxScreenPrivate *) sPriv->private; TDFXSAREAPriv *saPriv = (TDFXSAREAPriv *) ((char *) sPriv->pSAREA + sizeof(XF86DRISAREARec)); + struct dd_function_table functions; /* Allocate tdfx context */ fxMesa = (tdfxContextPtr) CALLOC( sizeof(tdfxContextRec) ); if (!fxMesa) return GL_FALSE; + /* Init default driver functions then plug in our tdfx-specific functions + * (the texture functions are especially important) + */ + _mesa_init_driver_functions(&functions); + tdfxDDInitDriverFuncs(mesaVis, &functions); + tdfxInitTextureFuncs(&functions); + tdfxInitRenderFuncs(&functions); + /* Allocate the Mesa context */ if (sharedContextPrivate) shareCtx = ((tdfxContextPtr) sharedContextPrivate)->glCtx; else shareCtx = NULL; - fxMesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void *) fxMesa, GL_TRUE); + fxMesa->glCtx = _mesa_create_context(mesaVis, shareCtx, + &functions, (void *) fxMesa); if (!fxMesa->glCtx) { FREE(fxMesa); return GL_FALSE; @@ -246,10 +258,9 @@ GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis, _swrast_allow_vertex_fog( ctx, GL_FALSE ); tdfxDDInitExtensions( ctx ); - tdfxDDInitDriverFuncs( ctx ); - tdfxDDInitStateFuncs( ctx ); - tdfxDDInitRenderFuncs( ctx ); + /* XXX these should really go right after _mesa_init_driver_functions() */ tdfxDDInitSpanFuncs( ctx ); + tdfxDDInitStateFuncs( ctx ); tdfxDDInitTriFuncs( ctx ); tdfxInitVB( ctx ); tdfxInitState( fxMesa ); -- cgit v1.2.3