free texture processing buffers each frame so they don't hang around wasting memory
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 1 Sep 2002 01:06:02 +0000 (01:06 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 1 Sep 2002 01:06:02 +0000 (01:06 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2323 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c
gl_textures.c
r_textures.h

index 4306818..82162e5 100644 (file)
@@ -620,6 +620,8 @@ void R_RenderView (void)
        R_MoveExplosions();
        R_TimeReport("mexplosion");
 
+       R_Textures_Frame();
+
        R_SetupFrame();
        R_SetFrustum();
        R_SetupFog();
index 10cba22..349d26f 100644 (file)
@@ -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;
index ebcd889..231ef9c 100644 (file)
@@ -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