]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
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 4306818f58948466ef885b8d691320b4f38d6867..82162e540f8adf2387a2008c24866b66c8a4f8bf 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 10cba22dd64283763d771ab38a33bf646648671e..349d26f3c5620179db3895fa0c98819b783b6d88 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 ebcd8893e71ce1f7817104e224a343e8aeaab067..231ef9cd06c955220bbafd44b0f810e8f0397070 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