From 8135a445f3b0ae207ec5e4485b5936050d438320 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Mon, 26 Jan 2004 23:38:12 +0000 Subject: Make the drivers using the common texmem code work with NewTextureObject in Mesa. This is analogous to changes idr made to the r200 driver. Patch submitted by Andreas Stenglein. --- src/mesa/drivers/dri/i810/i810context.c | 2 -- src/mesa/drivers/dri/i810/i810tex.c | 5 ++--- src/mesa/drivers/dri/i830/i830_context.c | 4 ---- src/mesa/drivers/dri/i830/i830_tex.c | 6 +++--- src/mesa/drivers/dri/mga/mga_xmesa.c | 4 ---- src/mesa/drivers/dri/mga/mgatex.c | 9 +++------ src/mesa/drivers/dri/r128/r128_context.c | 4 ---- src/mesa/drivers/dri/r128/r128_tex.c | 8 +++----- src/mesa/drivers/dri/radeon/radeon_context.c | 5 ----- src/mesa/drivers/dri/radeon/radeon_tex.c | 9 ++++----- 10 files changed, 15 insertions(+), 41 deletions(-) diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index 78698e861c..f443ce0201 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -292,8 +292,6 @@ i810CreateContext( const __GLcontextModes *mesaVis, i810InitVB( ctx ); i810InitState( ctx ); - driInitTextureObjects( ctx, &imesa->swapped, DRI_TEXMGR_DO_TEXTURE_2D); - #if DO_DEBUG I810_DEBUG = driParseDebugString( getenv( "I810_DEBUG" ), debug_control ); diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index cd9ef153b7..220d901d84 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -412,9 +412,7 @@ static void i810TexSubImage2D( GLcontext *ctx, static void i810BindTexture( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ) { - if (!tObj->DriverData) { - i810AllocTexObj( ctx, tObj ); - } + assert( (target != GL_TEXTURE_2D) || (tObj->DriverData != NULL) ); } @@ -532,6 +530,7 @@ i810NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); + i810AllocTexObj( ctx, obj ); return obj; } diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c index 74a7d77a86..0d6b2b7464 100644 --- a/src/mesa/drivers/dri/i830/i830_context.c +++ b/src/mesa/drivers/dri/i830/i830_context.c @@ -370,10 +370,6 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis, i830DDInitSpanFuncs( ctx ); i830DDInitState (ctx); - driInitTextureObjects( ctx, & imesa->swapped, - DRI_TEXMGR_DO_TEXTURE_2D - | DRI_TEXMGR_DO_TEXTURE_RECT ); - #if DO_DEBUG I830_DEBUG = driParseDebugString( getenv( "I830_DEBUG" ), debug_control ); diff --git a/src/mesa/drivers/dri/i830/i830_tex.c b/src/mesa/drivers/dri/i830/i830_tex.c index 3399859804..00b869a7a9 100644 --- a/src/mesa/drivers/dri/i830/i830_tex.c +++ b/src/mesa/drivers/dri/i830/i830_tex.c @@ -420,9 +420,8 @@ static void i830TexSubImage2D( GLcontext *ctx, static void i830BindTexture( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ) { - if (!tObj->DriverData) { - i830AllocTexObj( tObj ); - } + assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV) || + (tObj->DriverData != NULL) ); } @@ -565,6 +564,7 @@ i830NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); + i830AllocTexObj( obj ); return obj; } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index a3eb758d12..169615d0c0 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -527,10 +527,6 @@ mgaCreateContext( const __GLcontextModes *mesaVis, mgaDDInitPixelFuncs( ctx ); mgaDDInitTriFuncs( ctx ); - driInitTextureObjects( ctx, & mmesa->swapped, - (DRI_TEXMGR_DO_TEXTURE_2D | - DRI_TEXMGR_DO_TEXTURE_RECT) ); - mgaInitVB( ctx ); mgaInitState( mmesa ); diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index 2fef5b832a..1b45c0f901 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -484,12 +484,8 @@ static void mgaBindTexture( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ) { - if ( target == GL_TEXTURE_2D || - target == GL_TEXTURE_RECTANGLE_NV ) { - if ( tObj->DriverData == NULL ) { - mgaAllocTexObj( tObj ); - } - } + assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV) || + (tObj->DriverData != NULL) ); } @@ -523,6 +519,7 @@ mgaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); + mgaAllocTexObj( obj ); return obj; } diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index 7bb324473f..ea1c276770 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -245,10 +245,6 @@ GLboolean r128CreateContext( const __GLcontextModes *glVisual, r128DDInitSpanFuncs( ctx ); r128DDInitState( rmesa ); - driInitTextureObjects( ctx, & rmesa->swapped, - DRI_TEXMGR_DO_TEXTURE_1D - | DRI_TEXMGR_DO_TEXTURE_2D ); - rmesa->vblank_flags = (rmesa->r128Screen->irq != 0) ? driGetDefaultVBlankFlags(&rmesa->optionCache) : VBLANK_FLAG_NO_IRQ; diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 373ff5c76b..d459b6243d 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -561,11 +561,8 @@ static void r128BindTexture( GLcontext *ctx, GLenum target, ctx->Texture.CurrentUnit ); } - if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) { - if ( tObj->DriverData == NULL ) { - r128AllocTexObj( tObj ); - } - } + assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_1D) || + (tObj->DriverData != NULL) ); } @@ -598,6 +595,7 @@ r128NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); + r128AllocTexObj( obj ); return obj; } diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 6e9cc5f5d9..de197aa4db 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -354,11 +354,6 @@ radeonCreateContext( const __GLcontextModes *glVisual, rmesa->boxes = 0; - /* formerly in radeon_tex.c */ - driInitTextureObjects( ctx, & rmesa->swapped, - DRI_TEXMGR_DO_TEXTURE_1D - | DRI_TEXMGR_DO_TEXTURE_2D ); - /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext( ctx ); diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index 99aa4a458b..78220c6860 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -674,11 +674,9 @@ static void radeonBindTexture( GLcontext *ctx, GLenum target, ctx->Texture.CurrentUnit ); } - if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) { - if ( texObj->DriverData == NULL ) { - radeonAllocTexObj( texObj ); - } - } + assert( (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D && + target != GL_TEXTURE_RECTANGLE_NV) || + (texObj->DriverData != NULL) ); } @@ -741,6 +739,7 @@ radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) if (!obj) return NULL; obj->MaxAnisotropy = rmesa->initialMaxAnisotropy; + radeonAllocTexObj( obj ); return obj; } -- cgit v1.2.3