/** * Free the texture image data attached to all currently enabled * textures. Meant to be called by device drivers when transitioning * from software to hardware rendering. */ void _swrast_eject_texture_images(GLcontext *ctx) { GLuint u; if (!ctx->Texture._EnabledUnits) { /* no textures enabled */ return; } for (u = 0; u < ctx->Const.MaxTextureImageUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { struct gl_texture_object *texObj = ctx->Texture.Unit[u]._Current; ASSERT(texObj); if (texObj) { GLuint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; GLuint face; for (face = 0; face < numFaces; face++) { GLint lvl; for (lvl = texObj->BaseLevel; lvl <= texObj->_MaxLevel; lvl++) { struct gl_texture_image *texImg = texObj->Image[face][lvl]; if (texImg && texImg->Data) { _mesa_free_texmemory(texImg->Data); texImg->Data = NULL; } } } } } } }
static void intelFreeTextureImageData(struct gl_context * ctx, struct gl_texture_image *texImage) { struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intelImage = intel_texture_image(texImage); DBG("%s\n", __FUNCTION__); if (intelImage->mt) { intel_miptree_release(intel, &intelImage->mt); } if (texImage->Data) { _mesa_free_texmemory(texImage->Data); texImage->Data = NULL; } if (intelImage->depth_rb) { _mesa_reference_renderbuffer(&intelImage->depth_rb, NULL); } if (intelImage->stencil_rb) { _mesa_reference_renderbuffer(&intelImage->stencil_rb, NULL); } }
static void intelFreeTextureImageData(GLcontext * ctx, struct gl_texture_image *texImage) { struct intel_context *intel = intel_context(ctx); struct intel_texture_image *intelImage = intel_texture_image(texImage); DBG("%s\n", __FUNCTION__); if (intelImage->mt) { intel_miptree_release(intel, &intelImage->mt); } if (texImage->Data) { _mesa_free_texmemory(texImage->Data); texImage->Data = NULL; } }
/** * Free memory associated with this texture image. */ void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage) { radeon_texture_image* image = get_radeon_texture_image(timage); if (image->mt) { radeon_miptree_unreference(&image->mt); assert(!image->base.Data); } else { _mesa_free_texture_image_data(ctx, timage); } if (image->bo) { radeon_bo_unref(image->bo); image->bo = NULL; } if (timage->Data) { _mesa_free_texmemory(timage->Data); timage->Data = NULL; } }