From 37083a8ae69b552d9637cf5e97455486445e390b Mon Sep 17 00:00:00 2001 From: havoc Date: Sun, 1 Sep 2002 01:06:02 +0000 Subject: [PATCH] free texture processing buffers each frame so they don't hang around wasting memory git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2323 d7cf8633-e32d-0410-b094-e92efae38249 --- gl_rmain.c | 2 ++ gl_textures.c | 19 +++++++++++++++++++ r_textures.h | 3 +++ 3 files changed, 24 insertions(+) diff --git a/gl_rmain.c b/gl_rmain.c index 4306818f..82162e54 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -620,6 +620,8 @@ void R_RenderView (void) R_MoveExplosions(); R_TimeReport("mexplosion"); + R_Textures_Frame(); + R_SetupFrame(); R_SetFrustum(); R_SetupFog(); diff --git a/gl_textures.c b/gl_textures.c index 10cba22d..349d26f3 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -494,6 +494,25 @@ void R_Textures_Init (void) R_RegisterModule("R_Textures", r_textures_start, r_textures_shutdown, r_textures_newmap); } +void R_Textures_Frame (void) +{ + // could do procedural texture animation here, if we keep track of which + // textures were accessed this frame... + + // free the resize buffers + resizebuffersize = 0; + if (resizebuffer) + { + Mem_Free(resizebuffer); + resizebuffer = NULL; + } + if (colorconvertbuffer) + { + Mem_Free(colorconvertbuffer); + colorconvertbuffer = NULL; + } +} + static void R_Upload(gltexture_t *glt, qbyte *data) { int mip, width, height, internalformat; diff --git a/r_textures.h b/r_textures.h index ebcd8893..231ef9cd 100644 --- a/r_textures.h +++ b/r_textures.h @@ -77,5 +77,8 @@ int R_TextureWidth(rtexture_t *rt); // returns height of texture, as was specified when it was uploaded int R_TextureHeight(rtexture_t *rt); +// frees processing buffers each frame, and may someday animate procedural textures +void R_Textures_Frame(void); + #endif -- 2.39.2