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/mga/mga_xmesa.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers/dri/mga/mga_xmesa.c') diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index fa8057e732..6c26489d3c 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -40,6 +40,8 @@ #include "tnl/t_pipeline.h" +#include "drivers/common/driverfuncs.h" + #include "mgadd.h" #include "mgastate.h" #include "mgatex.h" @@ -352,6 +354,7 @@ mgaCreateContext( const __GLcontextModes *mesaVis, mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; MGASAREAPrivPtr saPriv=(MGASAREAPrivPtr)(((char*)sPriv->pSAREA)+ mgaScreen->sarea_priv_offset); + struct dd_function_table functions; if (MGA_DEBUG&DEBUG_VERBOSE_DRI) fprintf(stderr, "mgaCreateContext\n"); @@ -362,12 +365,21 @@ mgaCreateContext( const __GLcontextModes *mesaVis, return GL_FALSE; } + /* Init default driver functions then plug in our Radeon-specific functions + * (the texture functions are especially important) + */ + _mesa_init_driver_functions( &functions ); + mgaInitDriverFuncs( &functions ); + mgaInitTextureFuncs( &functions ); + mgaInitIoctlFuncs( &functions ); + /* Allocate the Mesa context */ if (sharedContextPrivate) shareCtx = ((mgaContextPtr) sharedContextPrivate)->glCtx; else shareCtx = NULL; - mmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, (void *) mmesa, GL_TRUE); + mmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, + &functions, (void *) mmesa); if (!mmesa->glCtx) { FREE(mmesa); return GL_FALSE; @@ -509,14 +521,16 @@ mgaCreateContext( const __GLcontextModes *mesaVis, driInitExtensions( ctx, g400_extensions, GL_FALSE ); } + /* XXX these should really go right after _mesa_init_driver_functions() */ mgaDDInitStateFuncs( ctx ); - mgaDDInitTextureFuncs( ctx ); mgaDDInitSpanFuncs( ctx ); - mgaDDInitDriverFuncs( ctx ); - mgaDDInitIoctlFuncs( ctx ); mgaDDInitPixelFuncs( ctx ); mgaDDInitTriFuncs( ctx ); + driInitTextureObjects( ctx, & mmesa->swapped, + (DRI_TEXMGR_DO_TEXTURE_2D | + DRI_TEXMGR_DO_TEXTURE_RECT) ); + mgaInitVB( ctx ); mgaInitState( mmesa ); -- cgit v1.2.3