Free mipmaps before freeing tags

ŝhould hopefully fix some random Z_free crashes
This commit is contained in:
Alug committed 2024-07-14 17:17:01 +02:00
1 parent b9b4de929d
commit 2437c5a19a
3 files changed
+8 -13

No files matched your search

+2 -2
View File
@@ -509,8 +509,8 @@ void HWR_FreeMipmapCache(void)
// free all hardware-converted graphics cached in the heap
// our gool is only the textures since user of the texture is the texture cache
Z_FreeTags(PU_HWRCACHE, PU_HWRCACHE);
Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRCACHE_UNLOCKED);
//Z_FreeTags(PU_HWRCACHE, PU_HWRCACHE);
//Z_FreeTags(PU_HWRCACHE_UNLOCKED, PU_HWRCACHE_UNLOCKED);
// Alam: free the Z_Blocks before freeing it's users
-11
View File
@@ -5760,17 +5760,6 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
void HWR_LoadLevel(void)
{
// Lactozilla (December 8, 2019)
// Level setup used to free EVERY mipmap from memory.
// Even mipmaps that aren't related to level textures.
// Presumably, the hardware render code used to store textures as level data.
// Meaning, they had memory allocated and marked with the PU_LEVEL tag.
// Level textures are only reloaded after R_LoadTextures, which is
// when the texture list is loaded.
// Sal: Unfortunately, NOT freeing them causes the dreaded Color Bug.
HWR_FreeMipmapCache();
HWR_CreatePlanePolygons((INT32)numnodes - 1);
if (HWR_ShouldUsePaletteRendering())
+6
View File
@@ -2770,6 +2770,12 @@ boolean P_SetupLevel(boolean skipprecip)
// Clear pointers that would be left dangling by the purge
R_FlushTranslationColormapCache();
#ifdef HWRENDER
// Free GPU textures before freeing patches.
if (rendermode == render_opengl && (vid.glstate == VID_GL_LIBRARY_LOADED))
HWR_FreeMipmapCache();
#endif
Z_FreeTags(PU_LEVEL, PU_PURGELEVEL - 1);
#if defined (WALLSPLATS) || defined (FLOORSPLATS)