diff options
| author | Brian Paul <brian.paul@tungstengraphics.com> | 2004-01-20 15:24:50 +0000 | 
|---|---|---|
| committer | Brian Paul <brian.paul@tungstengraphics.com> | 2004-01-20 15:24:50 +0000 | 
| commit | 4e713913fb88bc221eea1a18822cc782ca39af4d (patch) | |
| tree | 71607e8e178163d5e8b79df15582cce89c6728cd /src | |
| parent | d4636e74c86fad221c57a3a1704106e2367fc230 (diff) | |
Undo some bits from last check-in related to the ctx->Driver.NewTextureObject
functions.  Don't allocate the driver-specific data during texture object
creation but do it later as needed (as code originally was).
Diffstat (limited to 'src')
| -rw-r--r-- | src/mesa/drivers/dri/ffb/ffb_state.c | 26 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/ffb/ffb_tex.c | 14 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/ffb/ffb_xmesa.c | 12 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_context.c | 2 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_context.h | 1 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_tex.c | 70 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/i810/i810tex.c | 24 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/i830/i830_tex.c | 20 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/mga/mgatex.c | 21 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/r128/r128_tex.c | 19 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/r200/r200_tex.c | 18 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_tex.c | 17 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/sis/sis_tex.c | 48 | ||||
| -rw-r--r-- | src/mesa/drivers/dri/tdfx/tdfx_tex.c | 88 | ||||
| -rw-r--r-- | src/mesa/drivers/glide/fxddtex.c | 104 | 
15 files changed, 208 insertions, 276 deletions
| diff --git a/src/mesa/drivers/dri/ffb/ffb_state.c b/src/mesa/drivers/dri/ffb/ffb_state.c index 5a56c945ca..ac753b922a 100644 --- a/src/mesa/drivers/dri/ffb/ffb_state.c +++ b/src/mesa/drivers/dri/ffb/ffb_state.c @@ -1061,7 +1061,6 @@ void ffbDDInitStateFuncs(GLcontext *ctx)  	ctx->Driver.UpdateState = ffbDDUpdateState;  	ctx->Driver.Enable = ffbDDEnable; -	ctx->Driver.LightModelfv = NULL;  	ctx->Driver.AlphaFunc = ffbDDAlphaFunc;  	ctx->Driver.BlendEquation = ffbDDBlendEquation;  	ctx->Driver.BlendFunc = ffbDDBlendFunc; @@ -1072,8 +1071,6 @@ void ffbDDInitStateFuncs(GLcontext *ctx)  	ctx->Driver.LineStipple = ffbDDLineStipple;  	ctx->Driver.PolygonStipple = ffbDDPolygonStipple;  	ctx->Driver.Scissor = ffbDDScissor; -	ctx->Driver.CullFace = NULL; -	ctx->Driver.FrontFace = NULL;  	ctx->Driver.ColorMask = ffbDDColorMask;  	ctx->Driver.LogicOpcode = ffbDDLogicOp;  	ctx->Driver.Viewport = ffbDDViewport; @@ -1083,10 +1080,6 @@ void ffbDDInitStateFuncs(GLcontext *ctx)  		ctx->Driver.StencilFunc = ffbDDStencilFunc;  		ctx->Driver.StencilMask = ffbDDStencilMask;  		ctx->Driver.StencilOp = ffbDDStencilOp; -	} else { -		ctx->Driver.StencilFunc = NULL; -		ctx->Driver.StencilMask = NULL; -		ctx->Driver.StencilOp = NULL;  	}  	ctx->Driver.DrawBuffer = ffbDDDrawBuffer; @@ -1096,25 +1089,10 @@ void ffbDDInitStateFuncs(GLcontext *ctx)  	ctx->Driver.ClearStencil = ffbDDClearStencil;  	/* We will support color index modes later... -DaveM */ +        /*  	ctx->Driver.ClearIndex = 0;  	ctx->Driver.IndexMask = 0; - - - -	/* Pixel path fallbacks. -	 */ -	ctx->Driver.Accum = _swrast_Accum; -	ctx->Driver.CopyPixels = _swrast_CopyPixels; -	ctx->Driver.DrawPixels = _swrast_DrawPixels; -	ctx->Driver.ReadPixels = _swrast_ReadPixels; -	ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; - -	/* Swrast hooks for imaging extensions: -	 */ -	ctx->Driver.CopyColorTable = _swrast_CopyColorTable; -	ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; -	ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; -	ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; +        */  	{  		struct swrast_device_driver *swdd =  diff --git a/src/mesa/drivers/dri/ffb/ffb_tex.c b/src/mesa/drivers/dri/ffb/ffb_tex.c index 4fe5dea96a..24d7fe3cd2 100644 --- a/src/mesa/drivers/dri/ffb/ffb_tex.c +++ b/src/mesa/drivers/dri/ffb/ffb_tex.c @@ -25,17 +25,16 @@   *    David S. Miller <davem@redhat.com>   */ -#include <GL/gl.h> -#include "texformat.h" -#include "texstore.h" -#include "teximage.h" -#include "swrast/swrast.h" - -#include "ffb_tex.h" +#include "glheader.h" +#include "mtypes.h"  /* No texture unit, all software. */ +/* XXX this function isn't needed since _mesa_init_driver_functions() + * will make all these assignments. + */  void ffbDDInitTexFuncs(GLcontext *ctx)  { +        /*  	ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format;  	ctx->Driver.TexImage1D = _mesa_store_teximage1d;  	ctx->Driver.TexImage2D = _mesa_store_teximage2d; @@ -49,4 +48,5 @@ void ffbDDInitTexFuncs(GLcontext *ctx)  	ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d;  	ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d;  	ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; +	*/  } diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index caca9d4384..0d7a2fda20 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -38,6 +38,7 @@  #include "tnl/tnl.h"  #include "tnl/t_pipeline.h"  #include "array_cache/acache.h" +#include "drivers/common/driverfuncs.h"  #include "ffb_context.h"  #include "ffb_dd.h" @@ -178,18 +179,22 @@ ffbCreateContext(const __GLcontextModes *mesaVis,  	__DRIscreenPrivate *sPriv;  	ffbScreenPrivate *ffbScreen;  	char *debug; +	struct dd_function_table functions;          /* Allocate ffb context */  	fmesa = (ffbContextPtr) CALLOC(sizeof(ffbContextRec));  	if (!fmesa)  		return GL_FALSE; +	_mesa_init_driver_functions(&functions); +          /* Allocate Mesa context */          if (sharedContextPrivate)             shareCtx = ((ffbContextPtr) sharedContextPrivate)->glCtx;          else              shareCtx = NULL; -        fmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, fmesa, GL_TRUE); +        fmesa->glCtx = _mesa_create_context(mesaVis, shareCtx, +                                            &functions, fmesa);          if (!fmesa->glCtx) {             FREE(fmesa);             return GL_FALSE; @@ -265,6 +270,9 @@ ffbCreateContext(const __GLcontextModes *mesaVis,  	_swsetup_CreateContext( ctx );  	/* All of this need only be done once for a new context. */ +	/* XXX these should be moved right after the +	 *  _mesa_init_driver_functions() call above. +	 */  	ffbDDExtensionsInit(ctx);  	ffbDDInitDriverFuncs(ctx);  	ffbDDInitStateFuncs(ctx); @@ -272,7 +280,7 @@ ffbCreateContext(const __GLcontextModes *mesaVis,  	ffbDDInitDepthFuncs(ctx);  	ffbDDInitStencilFuncs(ctx);  	ffbDDInitRenderFuncs(ctx); -	ffbDDInitTexFuncs(ctx); +	/*ffbDDInitTexFuncs(ctx); not needed */  	ffbDDInitBitmapFuncs(ctx);  	ffbInitVB(ctx); diff --git a/src/mesa/drivers/dri/gamma/gamma_context.c b/src/mesa/drivers/dri/gamma/gamma_context.c index ff3b3a47fe..66f330758a 100644 --- a/src/mesa/drivers/dri/gamma/gamma_context.c +++ b/src/mesa/drivers/dri/gamma/gamma_context.c @@ -170,6 +170,8 @@ GLboolean gammaCreateContext( const __GLcontextModes *glVisual,     gammaDDInitTriFuncs( ctx );     gammaDDInitState( gmesa ); +   gammaInitTextureObjects( ctx ); +     driContextPriv->driverPrivate = (void *)gmesa;     GET_FIRST_DMA(gmesa->driFd, gmesa->hHWContext, diff --git a/src/mesa/drivers/dri/gamma/gamma_context.h b/src/mesa/drivers/dri/gamma/gamma_context.h index e969961644..92836178b6 100644 --- a/src/mesa/drivers/dri/gamma/gamma_context.h +++ b/src/mesa/drivers/dri/gamma/gamma_context.h @@ -192,6 +192,7 @@ void gammaDDInitState( gammaContextPtr gmesa );  void gammaInitHW( gammaContextPtr gmesa );  void gammaDDInitStateFuncs( GLcontext *ctx );  void gammaDDInitTextureFuncs( struct dd_function_table *table ); +void gammaInitTextureObjects( GLcontext *ctx );  void gammaDDInitTriFuncs( GLcontext *ctx );  void gammaUpdateWindow( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/gamma/gamma_tex.c b/src/mesa/drivers/dri/gamma/gamma_tex.c index b2f1d996b9..4af99e4da4 100644 --- a/src/mesa/drivers/dri/gamma/gamma_tex.c +++ b/src/mesa/drivers/dri/gamma/gamma_tex.c @@ -299,8 +299,6 @@ static void gammaTexSubImage2D( GLcontext *ctx,  			     texImage);  } -#if 0 -/* no longer needed */  static void gammaBindTexture( GLcontext *ctx, GLenum target,  			     struct gl_texture_object *tObj )  { @@ -325,8 +323,8 @@ static void gammaBindTexture( GLcontext *ctx, GLenum target,           if (target == GL_TEXTURE_2D) {              t->TextureAddressMode |= TAM_TexMapType_2D;              t->TextureReadMode |= TRM_TexMapType_2D; -         } else -         if (target == GL_TEXTURE_1D) { +         } +         else if (target == GL_TEXTURE_1D) {              t->TextureAddressMode |= TAM_TexMapType_1D;              t->TextureReadMode |= TRM_TexMapType_1D;           } @@ -353,7 +351,6 @@ static void gammaBindTexture( GLcontext *ctx, GLenum target,  	 gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );        }  } -#endif  static void gammaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )  { @@ -384,73 +381,17 @@ static GLboolean gammaIsTextureResident( GLcontext *ctx,   * Called via ctx->Driver.NewTextureObject.   * Note: this function will be called during context creation to   * allocate the default texture objects. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   */  static struct gl_texture_object *  gammaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  { -   gammaContextPtr gmesa = GAMMA_CONTEXT( ctx );     struct gl_texture_object *obj; -   gammaTextureObjectPtr t; -     obj = _mesa_new_texture_object(ctx, name, target); -   if (!obj) -      return NULL; - -   t = CALLOC_STRUCT(gamma_texture_object_t); -   if (!t) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   } - -   /* Initialize non-image-dependent parts of the state: -    */ -   t->globj = obj; -   obj->DriverData = t; - -   t->TextureAddressMode = TextureAddressModeEnable | TAM_Operation_3D | -      TAM_DY_Enable | TAM_LODEnable; -   t->TextureReadMode = TextureReadModeEnable | TRM_PrimaryCacheEnable | -      TRM_MipMapEnable | TRM_BorderClamp | TRM_Border; -   t->TextureColorMode = TextureColorModeEnable; -   t->TextureFilterMode = TextureFilterModeEnable; - -   if (target == GL_TEXTURE_2D) { -      t->TextureAddressMode |= TAM_TexMapType_2D; -      t->TextureReadMode |= TRM_TexMapType_2D; -   } -   else if (target == GL_TEXTURE_1D) { -      t->TextureAddressMode |= TAM_TexMapType_1D; -      t->TextureReadMode |= TRM_TexMapType_1D; -   } - -   t->TextureColorMode = TextureColorModeEnable; - -   t->TextureFilterMode = TextureFilterModeEnable; - -#ifdef MESA_LITTLE_ENDIAN -   t->TextureFormat = (TF_LittleEndian | -#else -   t->TextureFormat = (TF_BigEndian | -#endif -                       TF_ColorOrder_RGB | -                       TF_OutputFmt_Texel); - -   t->dirty_images = ~0; - -   make_empty_list( t ); - -   gammaSetTexWrapping( t, obj->WrapS, obj->WrapT ); -   gammaSetTexFilter( gmesa, t, obj->MinFilter, obj->MagFilter, -                      ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias); - -   gammaSetTexBorderColor( gmesa, t, obj->_BorderChan ); -     return obj;  } - -#if 0 -/* no longer needed */  void gammaInitTextureObjects( GLcontext *ctx )  {     struct gl_texture_object *texObj; @@ -476,7 +417,6 @@ void gammaInitTextureObjects( GLcontext *ctx )     ctx->Texture.CurrentUnit = tmp;  } -#endif  void gammaDDInitTextureFuncs( struct dd_function_table *functions ) @@ -484,7 +424,7 @@ void gammaDDInitTextureFuncs( struct dd_function_table *functions )     functions->TexEnv = gammaTexEnv;     functions->TexImage2D = gammaTexImage2D;     functions->TexSubImage2D = gammaTexSubImage2D; -   /*functions->BindTexture = gammaBindTexture;*/ +   functions->BindTexture = gammaBindTexture;     functions->DeleteTexture = gammaDeleteTexture;     functions->TexParameter = gammaTexParameter;     functions->IsTextureResident = gammaIsTextureResident; diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index bf404e36f0..cd9ef153b7 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -224,7 +224,8 @@ static void i810TexParameter( GLcontext *ctx, GLenum target,     i810ContextPtr imesa = I810_CONTEXT(ctx);     i810TextureObjectPtr t = (i810TextureObjectPtr) tObj->DriverData; -   assert(t); +   if (!t) +      return;     if ( target != GL_TEXTURE_2D )        return; @@ -341,7 +342,6 @@ static void i810TexImage1D( GLcontext *ctx, GLenum target, GLint level,  			    struct gl_texture_image *texImage )  {     i810TextureObjectPtr t = (i810TextureObjectPtr) texObj->DriverData; -   assert(t);     if (t) {        i810SwapOutTexObj( imesa, t );     } @@ -371,7 +371,6 @@ static void i810TexImage2D( GLcontext *ctx, GLenum target, GLint level,  			    struct gl_texture_image *texImage )  {     driTextureObject *t = (driTextureObject *) texObj->DriverData; -   assert(t);     if (t) {        I810_FIREVERTICES( I810_CONTEXT(ctx) );        driSwapOutTextureObject( t ); @@ -400,7 +399,6 @@ static void i810TexSubImage2D( GLcontext *ctx,  			       struct gl_texture_image *texImage )  {     driTextureObject *t = (driTextureObject *)texObj->DriverData; -   assert(t);     if (t) {       I810_FIREVERTICES( I810_CONTEXT(ctx) );       driSwapOutTextureObject( t ); @@ -411,17 +409,13 @@ static void i810TexSubImage2D( GLcontext *ctx,  } -#if 0 -/* not needed anymore */  static void i810BindTexture( GLcontext *ctx, GLenum target,  			     struct gl_texture_object *tObj )  { -   assert(t);     if (!tObj->DriverData) {        i810AllocTexObj( ctx, tObj ); -  } +   }  } -#endif  static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) @@ -530,20 +524,14 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,   * Called via ctx->Driver.NewTextureObject.   * Note: this function will be called during context creation to   * allocate the default texture objects. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   */  static struct gl_texture_object *  i810NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  {     struct gl_texture_object *obj; -   driTextureObject *t;     obj = _mesa_new_texture_object(ctx, name, target); -   if (!obj) -      return NULL; -   t = (driTextureObject *) i810AllocTexObj( ctx, obj ); -   if (!t) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   }     return obj;  } @@ -552,7 +540,7 @@ void i810InitTextureFuncs( struct dd_function_table *functions )     functions->ChooseTextureFormat = i810ChooseTextureFormat;     functions->TexImage2D = i810TexImage2D;     functions->TexSubImage2D = i810TexSubImage2D; -   /*functions->BindTexture = i810BindTexture;*/ +   functions->BindTexture = i810BindTexture;     functions->NewTextureObject = i810NewTextureObject;     functions->DeleteTexture = i810DeleteTexture;     functions->TexParameter = i810TexParameter; diff --git a/src/mesa/drivers/dri/i830/i830_tex.c b/src/mesa/drivers/dri/i830/i830_tex.c index 6524cef41a..3399859804 100644 --- a/src/mesa/drivers/dri/i830/i830_tex.c +++ b/src/mesa/drivers/dri/i830/i830_tex.c @@ -277,7 +277,8 @@ static void i830TexParameter( GLcontext *ctx, GLenum target,     i830TextureObjectPtr t = (i830TextureObjectPtr) tObj->DriverData;     GLuint unit = ctx->Texture.CurrentUnit; -   assert(t); +   if (!t) +      return;     if ( target != GL_TEXTURE_2D )        return; @@ -376,7 +377,6 @@ static void i830TexImage2D( GLcontext *ctx, GLenum target, GLint level,  			    struct gl_texture_image *texImage )  {     driTextureObject * t = (driTextureObject *) texObj->DriverData; -   assert(t);     if (t) {        I830_FIREVERTICES( I830_CONTEXT(ctx) );        driSwapOutTextureObject( t ); @@ -406,7 +406,6 @@ static void i830TexSubImage2D( GLcontext *ctx,  			       struct gl_texture_image *texImage )  {     driTextureObject * t = (driTextureObject *) texObj->DriverData; -   assert(t);     if (t) {        I830_FIREVERTICES( I830_CONTEXT(ctx) );        driSwapOutTextureObject( t ); @@ -418,8 +417,6 @@ static void i830TexSubImage2D( GLcontext *ctx,  } -#if 0 -/* no longer needed */  static void i830BindTexture( GLcontext *ctx, GLenum target,  			     struct gl_texture_object *tObj )  { @@ -427,7 +424,6 @@ static void i830BindTexture( GLcontext *ctx, GLenum target,        i830AllocTexObj( tObj );     }  } -#endif  static void i830DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) @@ -561,20 +557,14 @@ i830ChooseTextureFormat( GLcontext *ctx, GLint internalFormat,   * Called via ctx->Driver.NewTextureObject.   * Note: this function will be called during context creation to   * allocate the default texture objects. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   */  static struct gl_texture_object *  i830NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  {     struct gl_texture_object *obj; -   driTextureObject *t;     obj = _mesa_new_texture_object(ctx, name, target); -   if (!obj) -      return NULL; -   t = (driTextureObject *) i830AllocTexObj( obj ); -   if (!t) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   }     return obj;  } @@ -585,7 +575,7 @@ void i830InitTextureFuncs( struct dd_function_table *functions )     functions->ChooseTextureFormat       = i830ChooseTextureFormat;     functions->TexImage2D                = i830TexImage2D;     functions->TexSubImage2D             = i830TexSubImage2D; -   /*functions->BindTexture               = i830BindTexture;*/ +   functions->BindTexture               = i830BindTexture;     functions->TexParameter              = i830TexParameter;     functions->TexEnv                    = i830TexEnv;     functions->IsTextureResident         = driIsTextureResident; diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index b64335f303..2fef5b832a 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -366,7 +366,6 @@ static void mgaTexImage2D( GLcontext *ctx, GLenum target, GLint level,  {     driTextureObject * t = (driTextureObject *) texObj->DriverData; -   assert(t);     if ( t != NULL ) {        driSwapOutTextureObject( t );     }  @@ -437,7 +436,6 @@ mgaTexParameter( GLcontext *ctx, GLenum target,      * created with current state before it is used, so we don't have      * to do anything now       */ -   assert(t);     if ( (t == NULL) ||          (target != GL_TEXTURE_2D &&           target != GL_TEXTURE_RECTANGLE_NV) ) { @@ -482,8 +480,6 @@ mgaTexParameter( GLcontext *ctx, GLenum target,  } -#if 0 -/* no longer needed */  static void  mgaBindTexture( GLcontext *ctx, GLenum target,  		  struct gl_texture_object *tObj ) @@ -495,7 +491,6 @@ mgaBindTexture( GLcontext *ctx, GLenum target,        }     }  } -#endif  static void @@ -520,22 +515,14 @@ mgaDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj )   * Called via ctx->Driver.NewTextureObject.   * Note: this function will be called during context creation to   * allocate the default texture objects. - * Fixup MaxAnisotropy according to user preference. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   */  static struct gl_texture_object *  mgaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  { -   mgaContextPtr rmesa = MGA_CONTEXT(ctx);     struct gl_texture_object *obj; -   driTextureObject *t;     obj = _mesa_new_texture_object(ctx, name, target); -   if (!obj) -      return NULL; -   t = (driTextureObject *) mgaAllocTexObj( obj ); -   if (!t) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   }     return obj;  } @@ -546,10 +533,10 @@ mgaInitTextureFuncs( struct dd_function_table *functions )     functions->ChooseTextureFormat	= mgaChooseTextureFormat;     functions->TexImage2D		= mgaTexImage2D;     functions->TexSubImage2D		= mgaTexSubImage2D; -   /*ctx->Driver.BindTexture		= mgaBindTexture;*/ +   functions->BindTexture		= mgaBindTexture;     functions->NewTextureObject		= mgaNewTextureObject;     functions->DeleteTexture		= mgaDeleteTexture; -   functions->IsTextureResident	= driIsTextureResident; +   functions->IsTextureResident		= driIsTextureResident;     functions->TexEnv			= mgaTexEnv;     functions->TexParameter		= mgaTexParameter;  } diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 20e18dafee..373ff5c76b 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -299,7 +299,6 @@ static void r128TexImage1D( GLcontext *ctx, GLenum target, GLint level,  {     driTextureObject * t = (driTextureObject *) texObj->DriverData; -   assert(t);     if ( t ) {        driSwapOutTextureObject( t );     } @@ -363,7 +362,6 @@ static void r128TexImage2D( GLcontext *ctx, GLenum target, GLint level,  {     driTextureObject * t = (driTextureObject *) texObj->DriverData; -   assert(t);     if ( t ) {        driSwapOutTextureObject( (driTextureObject *) t );     } @@ -555,8 +553,6 @@ static void r128TexParameter( GLcontext *ctx, GLenum target,     }  } -#if 00 -/* note needed */  static void r128BindTexture( GLcontext *ctx, GLenum target,  			       struct gl_texture_object *tObj )  { @@ -571,7 +567,7 @@ static void r128BindTexture( GLcontext *ctx, GLenum target,        }     }  } -#endif +  static void r128DeleteTexture( GLcontext *ctx,  				 struct gl_texture_object *tObj ) @@ -594,21 +590,14 @@ static void r128DeleteTexture( GLcontext *ctx,  /**   * Allocate a new texture object.   * Called via ctx->Driver.NewTextureObject. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   */  static struct gl_texture_object *  r128NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  { -   r128ContextPtr rmesa = R128_CONTEXT(ctx);     struct gl_texture_object *obj; -   driTextureObject *t;     obj = _mesa_new_texture_object(ctx, name, target); -   if (!obj) -      return NULL; -   t = (driTextureObject *) r128AllocTexObj(obj); -   if (!t) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   }     return obj;  } @@ -621,7 +610,7 @@ void r128InitTextureFuncs( struct dd_function_table *functions )     functions->TexImage2D		= r128TexImage2D;     functions->TexSubImage2D		= r128TexSubImage2D;     functions->TexParameter		= r128TexParameter; -   /*functions->BindTexture		= r128BindTexture;*/ +   functions->BindTexture		= r128BindTexture;     functions->NewTextureObject		= r128NewTextureObject;     functions->DeleteTexture		= r128DeleteTexture;     functions->IsTextureResident		= driIsTextureResident; diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 1990d66191..c1c535507f 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -554,7 +554,6 @@ static void r200TexImage1D( GLcontext *ctx, GLenum target, GLint level,  {     driTextureObject * t = (driTextureObject *) texObj->DriverData; -   assert(t);     if ( t ) {        driSwapOutTextureObject( t );     } @@ -617,8 +616,6 @@ static void r200TexImage2D( GLcontext *ctx, GLenum target, GLint level,     driTextureObject * t = (driTextureObject *) texObj->DriverData;     GLuint face; -   assert(t); -     /* which cube face or ordinary 2D image */     switch (target) {     case GL_TEXTURE_CUBE_MAP_POSITIVE_X: @@ -733,8 +730,6 @@ static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level,  {     driTextureObject * t = (driTextureObject *) texObj->DriverData; -   assert(t); -     if ( t ) {        driSwapOutTextureObject( t );     } @@ -938,8 +933,6 @@ static void r200TexParameter( GLcontext *ctx, GLenum target, -#if 0 -/* not needed anymore */  static void r200BindTexture( GLcontext *ctx, GLenum target,  			       struct gl_texture_object *texObj )  { @@ -954,7 +947,6 @@ static void r200BindTexture( GLcontext *ctx, GLenum target,        }     }  } -#endif  static void r200DeleteTexture( GLcontext *ctx, @@ -1007,6 +999,8 @@ static void r200TexGen( GLcontext *ctx,   * Called via ctx->Driver.NewTextureObject.   * Note: this function will be called during context creation to   * allocate the default texture objects. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   * Fixup MaxAnisotropy according to user preference.   */  static struct gl_texture_object * @@ -1014,16 +1008,10 @@ r200NewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  {     r200ContextPtr rmesa = R200_CONTEXT(ctx);     struct gl_texture_object *obj; -   driTextureObject *t;     obj = _mesa_new_texture_object(ctx, name, target);     if (!obj)        return NULL;     obj->MaxAnisotropy = rmesa->initialMaxAnisotropy; -   t = (driTextureObject *) r200AllocTexObj( obj ); -   if (!t) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   }     return obj;  } @@ -1049,7 +1037,7 @@ void r200InitTextureFuncs( struct dd_function_table *functions )     functions->TexSubImage3D		= _mesa_store_texsubimage3d;  #endif     functions->NewTextureObject		= r200NewTextureObject; -   /*functions->BindTexture		= r200BindTexture;*/ +   functions->BindTexture		= r200BindTexture;     functions->DeleteTexture		= r200DeleteTexture;     functions->IsTextureResident		= driIsTextureResident; diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index ca6acba16a..99aa4a458b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -401,7 +401,6 @@ static void radeonTexImage1D( GLcontext *ctx, GLenum target, GLint level,  {     driTextureObject * t = (driTextureObject *) texObj->DriverData; -   assert(t);     if ( t ) {        driSwapOutTextureObject( t );     } @@ -464,8 +463,6 @@ static void radeonTexImage2D( GLcontext *ctx, GLenum target, GLint level,     driTextureObject * t = (driTextureObject *) texObj->DriverData;     GLuint face; -   assert(t); -     /* which cube face or ordinary 2D image */     switch (target) {     case GL_TEXTURE_CUBE_MAP_POSITIVE_X: @@ -669,8 +666,6 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target,  } -#if 00 -/* not needed anymore */  static void radeonBindTexture( GLcontext *ctx, GLenum target,  			       struct gl_texture_object *texObj )  { @@ -685,7 +680,7 @@ static void radeonBindTexture( GLcontext *ctx, GLenum target,        }     }  } -#endif +  static void radeonDeleteTexture( GLcontext *ctx,  				 struct gl_texture_object *texObj ) @@ -734,22 +729,18 @@ static void radeonTexGen( GLcontext *ctx,  /**   * Allocate a new texture object.   * Called via ctx->Driver.NewTextureObject. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   */  static struct gl_texture_object *  radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  {     radeonContextPtr rmesa = RADEON_CONTEXT(ctx);     struct gl_texture_object *obj; -   driTextureObject *t;     obj = _mesa_new_texture_object(ctx, name, target);     if (!obj)        return NULL;     obj->MaxAnisotropy = rmesa->initialMaxAnisotropy; -   t = (driTextureObject *) radeonAllocTexObj(obj); -   if (!t) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   }     return obj;  } @@ -763,7 +754,7 @@ void radeonInitTextureFuncs( struct dd_function_table *functions )     functions->TexSubImage2D		= radeonTexSubImage2D;     functions->NewTextureObject		= radeonNewTextureObject; -   /*functions->BindTexture		= radeonBindTexture;*/ +   functions->BindTexture		= radeonBindTexture;     functions->DeleteTexture		= radeonDeleteTexture;     functions->IsTextureResident		= driIsTextureResident; diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index ece0c519b7..e100e8e6a6 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -161,9 +161,17 @@ sisBindTexture( GLcontext *ctx, GLenum target,                  struct gl_texture_object *texObj )  {     sisContextPtr smesa = SIS_CONTEXT(ctx); -   sisTexObjPtr t = texObj->DriverData; +   sisTexObjPtr t; -   assert(t); +   if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) { +      if ( texObj->DriverData == NULL ) { +         sisAllocTexObj( texObj ); +      } +   } + +   t = texObj->DriverData; +   if (!t) +      return;     if (smesa->PrevTexFormat[ctx->Texture.CurrentUnit] != t->format) {        smesa->TexStates[ctx->Texture.CurrentUnit] |= NEW_TEXTURE_ENV; @@ -182,7 +190,6 @@ sisDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj )     smesa->clearTexCache = GL_TRUE;     t = texObj->DriverData; -   assert(t);     if (t == NULL) {        /*          * this shows the texture is default object and never be a  @@ -276,9 +283,12 @@ static void sisTexImage1D( GLcontext *ctx, GLenum target, GLint level,  			     struct gl_texture_image *texImage )  {     sisContextPtr smesa = SIS_CONTEXT(ctx); -   sisTexObjPtr t = texObj->DriverData; +   sisTexObjPtr t; + +   if ( texObj->DriverData == NULL ) +      sisAllocTexObj( texObj ); +   t = texObj->DriverData; -   assert(t);     /* Note, this will call sisChooseTextureFormat */     _mesa_store_teximage1d( ctx, target, level, internalFormat,  			   width, border, format, type, @@ -312,13 +322,15 @@ static void sisTexSubImage1D( GLcontext *ctx,  				struct gl_texture_image *texImage )  {     sisContextPtr smesa = SIS_CONTEXT(ctx); -   sisTexObjPtr t = texObj->DriverData; +   sisTexObjPtr t;     GLuint copySize;     GLint texelBytes;     const char *src;     GLubyte *dst; -   assert(t); +   if ( texObj->DriverData == NULL ) +      sisAllocTexObj( texObj ); +   t = texObj->DriverData;     _mesa_store_texsubimage1d(ctx, target, level, xoffset, width,  			     format, type, pixels, packing, texObj, @@ -356,9 +368,11 @@ static void sisTexImage2D( GLcontext *ctx, GLenum target, GLint level,  			     struct gl_texture_image *texImage )  {     sisContextPtr smesa = SIS_CONTEXT(ctx); -   sisTexObjPtr t = texObj->DriverData; +   sisTexObjPtr t; -   assert(t); +   if ( texObj->DriverData == NULL ) +      sisAllocTexObj( texObj ); +   t = texObj->DriverData;     /* Note, this will call sisChooseTextureFormat */     _mesa_store_teximage2d(ctx, target, level, internalFormat, @@ -392,7 +406,7 @@ static void sisTexSubImage2D( GLcontext *ctx,  				struct gl_texture_image *texImage )  {     sisContextPtr smesa = SIS_CONTEXT(ctx); -   sisTexObjPtr t = texObj->DriverData; +   sisTexObjPtr t;     GLuint copySize;     GLint texelBytes;     const char *src; @@ -400,7 +414,9 @@ static void sisTexSubImage2D( GLcontext *ctx,     int j;     GLuint soffset; -   assert(t); +   if ( texObj->DriverData == NULL ) +      sisAllocTexObj( texObj ); +   t = texObj->DriverData;     _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width,  			     height, format, type, pixels, packing, texObj, @@ -442,20 +458,14 @@ static void sisTexSubImage2D( GLcontext *ctx,   * Called via ctx->Driver.NewTextureObject.   * Note: this function will be called during context creation to   * allocate the default texture objects. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   */  static struct gl_texture_object *  sisNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  {     struct gl_texture_object *obj; -   sisTexObjPtr t;     obj = _mesa_new_texture_object(ctx, name, target); -   if (!obj) -      return NULL; -   t = (sisTexObjPtr) sisAllocTexObj( obj ); -   if (!t) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   }     return obj;  } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index d25a03da9c..3463cc5a6d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -200,6 +200,36 @@ static void RevalidateTexture(GLcontext *ctx, struct gl_texture_object *tObj)  } +static tdfxTexInfo * +fxAllocTexObjData(tdfxContextPtr fxMesa) +{ +    tdfxTexInfo *ti; + +    if (!(ti = CALLOC(sizeof(tdfxTexInfo)))) { +        _mesa_problem(NULL, "tdfx driver: out of memory"); +        return NULL; +    } + +    ti->isInTM = GL_FALSE; + +    ti->whichTMU = TDFX_TMU_NONE; + +    ti->tm[TDFX_TMU0] = NULL; +    ti->tm[TDFX_TMU1] = NULL; + +    ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; +    ti->magFilt = GR_TEXTUREFILTER_BILINEAR; + +    ti->sClamp = GR_TEXTURECLAMP_WRAP; +    ti->tClamp = GR_TEXTURECLAMP_WRAP; + +    ti->mmMode = GR_MIPMAP_NEAREST; +    ti->LODblend = FXFALSE; + +    return ti; +} + +  /*   * Called via glBindTexture.   */ @@ -218,8 +248,11 @@ tdfxBindTexture(GLcontext * ctx, GLenum target,      if (target != GL_TEXTURE_2D)          return; +    if (!tObj->DriverData) { +        tObj->DriverData = fxAllocTexObjData(fxMesa); +    } +      ti = TDFX_TEXTURE_DATA(tObj); -    assert(ti);      ti->lastTimeUsed = fxMesa->texBindNumber++;      fxMesa->new_state |= TDFX_NEW_TEXTURE; @@ -272,8 +305,10 @@ tdfxTexParameter(GLcontext * ctx, GLenum target,      if (target != GL_TEXTURE_2D)          return; +    if (!tObj->DriverData) +        tObj->DriverData = fxAllocTexObjData(fxMesa); +      ti = TDFX_TEXTURE_DATA(tObj); -    assert(ti);      switch (pname) {      case GL_TEXTURE_MIN_FILTER: @@ -514,6 +549,8 @@ tdfxTexturePalette(GLcontext * ctx, struct gl_texture_object *tObj)          if (!tObj->Palette.Table)              return; +        if (!tObj->DriverData) +            tObj->DriverData = fxAllocTexObjData(fxMesa);          ti = TDFX_TEXTURE_DATA(tObj);          assert(ti);          convertPalette(ti->palette.data, &tObj->Palette); @@ -880,6 +917,14 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level,      */      ti = TDFX_TEXTURE_DATA(texObj); +    if (!ti) { +        texObj->DriverData = fxAllocTexObjData(fxMesa); +        if (!texObj->DriverData) { +            _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); +            return; +        } +        ti = TDFX_TEXTURE_DATA(texObj); +    }      assert(ti);      mml = TDFX_TEXIMAGE_DATA(texImage); @@ -986,6 +1031,11 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,      tdfxMipMapLevel *mml;      GLint texelBytes; +    if (!texObj->DriverData) { +        _mesa_problem(ctx, "problem in fxDDTexSubImage2D"); +        return; +    } +      ti = TDFX_TEXTURE_DATA(texObj);      assert(ti);      mml = TDFX_TEXIMAGE_DATA(texImage); @@ -1234,6 +1284,8 @@ tdfxTestProxyTexImage(GLcontext *ctx, GLenum target,              int memNeeded;              tObj = ctx->Texture.Proxy2D; +            if (!tObj->DriverData) +                tObj->DriverData = fxAllocTexObjData(fxMesa);              ti = TDFX_TEXTURE_DATA(tObj);              assert(ti); @@ -1308,6 +1360,9 @@ tdfxGetCompressedTexImage( GLcontext *ctx, GLenum target,      if (target != GL_TEXTURE_2D)          return; +    if (!texObj->DriverData) +        return; +      ti = TDFX_TEXTURE_DATA(texObj);      assert(ti);      mml = &ti->mipmapLevel[lod]; @@ -1428,39 +1483,14 @@ tdfxDDCompressedImageSize(GLcontext *ctx,   * Called via ctx->Driver.NewTextureObject.   * Note: this function will be called during context creation to   * allocate the default texture objects. + * Note: we could use containment here to 'derive' the driver-specific + * texture object from the core mesa gl_texture_object.  Not done at this time.   */  static struct gl_texture_object *  tdfxNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  {     struct gl_texture_object *obj; -   tdfxTexInfo *ti;     obj = _mesa_new_texture_object(ctx, name, target); -   if (!obj) -      return NULL; - -   if (!(ti = CALLOC(sizeof(tdfxTexInfo)))) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   } - -   ti->isInTM = GL_FALSE; - -   ti->whichTMU = TDFX_TMU_NONE; - -   ti->tm[TDFX_TMU0] = NULL; -   ti->tm[TDFX_TMU1] = NULL; - -   ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; -   ti->magFilt = GR_TEXTUREFILTER_BILINEAR; - -   ti->sClamp = GR_TEXTURECLAMP_WRAP; -   ti->tClamp = GR_TEXTURECLAMP_WRAP; - -   ti->mmMode = GR_MIPMAP_NEAREST; -   ti->LODblend = FXFALSE; - -   obj->DriverData = ti; -     return obj;  } diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 9081f470dd..62f4ad15ee 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -90,8 +90,9 @@ static void  fxTexInvalidate(GLcontext * ctx, struct gl_texture_object *tObj)  {     fxMesaContext fxMesa = FX_CONTEXT(ctx); -   tfxTexInfo *ti = fxTMGetTexInfo(tObj); -   assert(ti); +   tfxTexInfo *ti; + +   ti = fxTMGetTexInfo(tObj);     if (ti->isInTM)        fxTMMoveOutTM(fxMesa, tObj);	/* TO DO: SLOW but easy to write */ @@ -99,6 +100,37 @@ fxTexInvalidate(GLcontext * ctx, struct gl_texture_object *tObj)     fxMesa->new_state |= FX_NEW_TEXTURING;  } +static tfxTexInfo * +fxAllocTexObjData(fxMesaContext fxMesa) +{ +   tfxTexInfo *ti; + +   if (!(ti = CALLOC(sizeof(tfxTexInfo)))) { +      fprintf(stderr, "fxAllocTexObjData: ERROR: out of memory !\n"); +      fxCloseHardware(); +      exit(-1); +   } + +   ti->validated = GL_FALSE; +   ti->isInTM = GL_FALSE; + +   ti->whichTMU = FX_TMU_NONE; + +   ti->tm[FX_TMU0] = NULL; +   ti->tm[FX_TMU1] = NULL; + +   ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; +   ti->maxFilt = GR_TEXTUREFILTER_BILINEAR; + +   ti->sClamp = GR_TEXTURECLAMP_WRAP; +   ti->tClamp = GR_TEXTURECLAMP_WRAP; + +   ti->mmMode = GR_MIPMAP_NEAREST; +   ti->LODblend = FXFALSE; + +   return ti; +} +  void  fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj)  { @@ -112,6 +144,9 @@ fxDDTexBind(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj)     if (target != GL_TEXTURE_2D)        return; +   if (!tObj->DriverData) { +      tObj->DriverData = fxAllocTexObjData(fxMesa); +   }     ti = fxTMGetTexInfo(tObj);     assert(ti); @@ -165,6 +200,8 @@ fxDDTexParam(GLcontext * ctx, GLenum target, struct gl_texture_object *tObj,     if (target != GL_TEXTURE_2D)        return; +   if (!tObj->DriverData) +      tObj->DriverData = fxAllocTexObjData(fxMesa);     ti = fxTMGetTexInfo(tObj);     assert(ti); @@ -321,7 +358,8 @@ fxDDTexDel(GLcontext * ctx, struct gl_texture_object *tObj)        fprintf(stderr, "fxDDTexDel(%d, %p)\n", tObj->Name, (void *) ti);     } -   assert(ti); +   if (!ti) +      return;     fxTMFreeTexture(fxMesa, tObj); @@ -343,37 +381,7 @@ struct gl_texture_object *  fxDDNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )  {     struct gl_texture_object *obj; -   fxTexInfo *ti; -     obj = _mesa_new_texture_object(ctx, name, target); -   if (!obj) -      return NULL; - -   ti = CALLOC(sizeof(tfxTexInfo)); -   if (!ti) { -      _mesa_delete_texture_object(ctx, obj); -      return NULL; -   } - -   ti->validated = GL_FALSE; -   ti->isInTM = GL_FALSE; - -   ti->whichTMU = FX_TMU_NONE; - -   ti->tm[FX_TMU0] = NULL; -   ti->tm[FX_TMU1] = NULL; - -   ti->minFilt = GR_TEXTUREFILTER_POINT_SAMPLED; -   ti->maxFilt = GR_TEXTUREFILTER_BILINEAR; - -   ti->sClamp = GR_TEXTURECLAMP_WRAP; -   ti->tClamp = GR_TEXTURECLAMP_WRAP; - -   ti->mmMode = GR_MIPMAP_NEAREST; -   ti->LODblend = FXFALSE; - -   obj->DriverData = ti; -     return obj;  } @@ -471,6 +479,8 @@ fxDDTexPalette(GLcontext * ctx, struct gl_texture_object *tObj)  	 fprintf(stderr, "fxDDTexPalette(%d, %x)\n",  		 tObj->Name, (GLuint) tObj->DriverData);        } +      if (!tObj->DriverData) +         tObj->DriverData = fxAllocTexObjData(fxMesa);        ti = fxTMGetTexInfo(tObj);        assert(ti);        ti->paltype = convertPalette(fxMesa, ti->palette.data, &tObj->Palette); @@ -507,6 +517,8 @@ fxDDTexUseGlbPalette(GLcontext * ctx, GLboolean state)        if ((ctx->Texture.Unit[0]._Current == ctx->Texture.Unit[0].Current2D) &&  	  (ctx->Texture.Unit[0]._Current != NULL)) {  	 struct gl_texture_object *tObj = ctx->Texture.Unit[0]._Current; +         if (!tObj->DriverData) +           tObj->DriverData = fxAllocTexObjData(fxMesa);  	 assert(tObj->DriverData);  	 fxTexInvalidate(ctx, tObj);        } @@ -1221,8 +1233,13 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,        return;     } -   ti = fxTMGetTexInfo(texObj); -   assert(ti); +   if (!texObj->DriverData) { +      texObj->DriverData = fxAllocTexObjData(fxMesa); +      if (!texObj->DriverData) { +         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); +         return; +      } +   }     if (!texImage->DriverData) {        texImage->DriverData = CALLOC(sizeof(tfxMipMapLevel)); @@ -1231,6 +1248,8 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,           return;        }     } +   ti = fxTMGetTexInfo(texObj); +     mml = FX_MIPMAP_DATA(texImage);     fxTexGetInfo(width, height, NULL, NULL, NULL, NULL, @@ -1420,6 +1439,11 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level,         fprintf(stderr, "fxDDTexSubImage2D: id=%d\n", texObj->Name);     } +   if (!texObj->DriverData) { +      _mesa_problem(ctx, "problem in fxDDTexSubImage2D"); +      return; +   } +     ti = fxTMGetTexInfo(texObj);     assert(ti);     mml = FX_MIPMAP_DATA(texImage); @@ -1512,8 +1536,13 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target,        return;     } -   ti = fxTMGetTexInfo(texObj); -   assert(ti); +   if (!texObj->DriverData) { +      texObj->DriverData = fxAllocTexObjData(fxMesa); +      if (!texObj->DriverData) { +         _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); +         return; +      } +   }     if (!texImage->DriverData) {        texImage->DriverData = CALLOC(sizeof(tfxMipMapLevel)); @@ -1522,6 +1551,7 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target,           return;        }     } +   ti = fxTMGetTexInfo(texObj);     mml = FX_MIPMAP_DATA(texImage);     fxTexGetInfo(width, height, NULL, NULL, NULL, NULL, | 
