diff options
author | Brian Paul <brianp@vmware.com> | 2011-09-17 14:50:48 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2011-09-17 14:57:40 -0600 |
commit | 146f536b3332b7a2022bb4ba5e2d1d2ec4bedd98 (patch) | |
tree | 863c2ee5f23d879dddb36ec7191c03bd915ba384 /src | |
parent | baeefef2c0445bfd717a3086fdd9b5bd5d9cb675 (diff) | |
download | external_mesa3d-146f536b3332b7a2022bb4ba5e2d1d2ec4bedd98.zip external_mesa3d-146f536b3332b7a2022bb4ba5e2d1d2ec4bedd98.tar.gz external_mesa3d-146f536b3332b7a2022bb4ba5e2d1d2ec4bedd98.tar.bz2 |
mesa: add new DeleteTextureImage() driver hook
Matches the NewTextureImage() hook. With new subclasses of
gl_texture_image coming we need a new hook to properly delete objects of
those subclasses.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/common/driverfuncs.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texture.c | 8 | ||||
-rw-r--r-- | src/mesa/main/dd.h | 4 | ||||
-rw-r--r-- | src/mesa/main/teximage.c | 3 | ||||
-rw-r--r-- | src/mesa/main/texobj.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 10 |
7 files changed, 34 insertions, 2 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 36ed4f8..50abfc8 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -111,6 +111,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->NewTextureObject = _mesa_new_texture_object; driver->DeleteTexture = _mesa_delete_texture_object; driver->NewTextureImage = _mesa_new_texture_image; + driver->DeleteTextureImage = _mesa_delete_texture_image; driver->FreeTextureImageBuffer = _mesa_free_texture_image_data; driver->MapTextureImage = _swrast_map_teximage; driver->UnmapTextureImage = _swrast_unmap_teximage; diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index f979523..8d3cbd6 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -18,6 +18,13 @@ intelNewTextureImage(struct gl_context * ctx) return (struct gl_texture_image *) CALLOC_STRUCT(intel_texture_image); } +static void +intelDeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img) +{ + /* nothing special (yet) for intel_texture_image */ + _mesa_delete_texture_image(ctx, img); +} + static struct gl_texture_object * intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) @@ -207,6 +214,7 @@ intelInitTextureFuncs(struct dd_function_table *functions) functions->NewTextureObject = intelNewTextureObject; functions->NewTextureImage = intelNewTextureImage; + functions->DeleteTextureImage = intelDeleteTextureImage; functions->DeleteTexture = intelDeleteTextureObject; functions->FreeTextureImageBuffer = intel_free_texture_image_buffer; functions->MapTextureImage = intel_map_texture_image; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 9964663..182f444 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -83,6 +83,13 @@ struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx) return CALLOC(sizeof(radeon_texture_image)); } +static void +radeonDeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img) +{ + /* nothing special (yet) for radeon_texture_image */ + _mesa_delete_texture_image(ctx, img); +} + /** * Free memory associated with this texture image. */ @@ -1162,6 +1169,7 @@ radeon_init_common_texture_funcs(radeonContextPtr radeon, struct dd_function_table *functions) { functions->NewTextureImage = radeonNewTextureImage; + functions->DeleteTextureImage = radeonDeleteTextureImage; functions->FreeTextureImageBuffer = radeonFreeTextureImageBuffer; functions->MapTexture = radeonMapTexture; functions->UnmapTexture = radeonUnmapTexture; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index d6cc019..18b1b01 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -476,6 +476,10 @@ struct dd_function_table { */ struct gl_texture_image * (*NewTextureImage)( struct gl_context *ctx ); + /** Called to free a texture image object returned by NewTextureImage() */ + void (*DeleteTextureImage)(struct gl_context *ctx, + struct gl_texture_image *); + /** * Called to free tImage->Data. */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index e11acc4..2973b6d 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -601,7 +601,8 @@ _mesa_free_texture_image_data(struct gl_context *ctx, /** - * Free texture image. + * Free a gl_texture_image and associated data. + * This function is a fallback called via ctx->Driver.DeleteTextureImage(). * * \param texImage texture image. * diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 1168f18..1b90cca 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -202,7 +202,7 @@ _mesa_delete_texture_object(struct gl_context *ctx, for (face = 0; face < 6; face++) { for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { if (texObj->Image[face][i]) { - _mesa_delete_texture_image( ctx, texObj->Image[face][i] ); + ctx->Driver.DeleteTextureImage(ctx, texObj->Image[face][i]); } } } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 2a971c5..68323a3 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -105,6 +105,15 @@ st_NewTextureImage(struct gl_context * ctx) } +/** called via ctx->Driver.DeleteTextureImage() */ +static void +st_DeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img) +{ + /* nothing special (yet) for st_texture_image */ + _mesa_delete_texture_image(ctx, img); +} + + /** called via ctx->Driver.NewTextureObject() */ static struct gl_texture_object * st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) @@ -1918,6 +1927,7 @@ st_init_texture_functions(struct dd_function_table *functions) functions->NewTextureObject = st_NewTextureObject; functions->NewTextureImage = st_NewTextureImage; + functions->DeleteTextureImage = st_DeleteTextureImage; functions->DeleteTexture = st_DeleteTextureObject; functions->FreeTextureImageBuffer = st_FreeTextureImageBuffer; functions->MapTextureImage = st_MapTextureImage; |