diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 8147406ce..c08d739bc 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5731,6 +5731,17 @@ 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()) diff --git a/src/p_setup.c b/src/p_setup.c index 99641c230..adafc9382 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2784,12 +2784,6 @@ boolean P_SetupLevel(boolean skipprecip, boolean reloadinggamestate) // 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)