mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 15:58:05 +02:00
added _swrast_eject_texture_images()
This commit is contained in:
parent
2807d1f58a
commit
fdb3acf016
2 changed files with 43 additions and 0 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include "colormac.h"
|
||||
#include "mtypes.h"
|
||||
#include "program.h"
|
||||
#include "teximage.h"
|
||||
#include "swrast.h"
|
||||
#include "s_blend.h"
|
||||
#include "s_context.h"
|
||||
|
|
@ -406,6 +407,44 @@ _swrast_validate_texture_images(GLcontext *ctx)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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++) {
|
||||
GLuint 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
|
||||
_swrast_sleep( GLcontext *ctx, GLbitfield new_state )
|
||||
|
|
|
|||
|
|
@ -244,6 +244,10 @@ _swrast_copy_texsubimage3d(GLcontext *ctx,
|
|||
GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
|
||||
extern void
|
||||
_swrast_eject_texture_images(GLcontext *ctx);
|
||||
|
||||
|
||||
/**
|
||||
* The driver interface for the software rasterizer.
|
||||
* XXX this may go away.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue