From 03b26a07235f67213f94e4da0384a538a8bdd4c2 Mon Sep 17 00:00:00 2001 From: NepDisk Date: Sat, 31 Jan 2026 12:00:11 -0500 Subject: [PATCH] Always reload texture arrays on renderer switch and bring back ingame renderer hotswapping All this texture load blocking var does is cause issues due to order of operations and what not. Lets just kill it. Thanks Alug for looking at this stuff for me! --- src/d_main.cpp | 3 --- src/hardware/hw_cache.c | 5 ----- src/hardware/hw_main.c | 3 +-- src/hardware/hw_main.h | 1 - src/screen.c | 8 -------- src/screen.h | 1 - 6 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/d_main.cpp b/src/d_main.cpp index dd9f3b7ef..5d00a3442 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -595,14 +595,11 @@ static void D_Display(void) // STUPID race condition... { wipegamestate = gamestate; - cansetrender = true; // clean up border stuff // see if the border needs to be initially drawn if (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction && curbghide && (!hidetitlemap))) { - // Rendering a level; don't allow renderer changes! - cansetrender = false; D_RenderLevel(); diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index bb44952da..916742677 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -620,7 +620,6 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm static size_t gl_numtextures = 0; // Texture count static GLMapTexture_t *gl_textures; // For all textures static GLMapTexture_t *gl_flats; // For all (texture) flats, as normal flats don't need to be cached -boolean gl_maptexturesloaded = false; void HWR_FreeTextureData(patch_t *patch) { @@ -748,7 +747,6 @@ void HWR_InitMapTextures(void) { gl_textures = NULL; gl_flats = NULL; - gl_maptexturesloaded = false; } static void FreeMapTexture(GLMapTexture_t *tex) @@ -778,7 +776,6 @@ void HWR_FreeMapTextures(void) gl_textures = NULL; gl_flats = NULL; gl_numtextures = 0; - gl_maptexturesloaded = false; } static void HWR_PrecacheLevelFlats(void) @@ -1025,8 +1022,6 @@ void HWR_LoadMapTextures(size_t pnumtextures) if (gl_textures == NULL || gl_flats == NULL) I_Error("HWR_LoadMapTextures: ran out of memory for OpenGL textures"); - - gl_maptexturesloaded = true; } // -------------------------------------------------------------------------- diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 4765747bc..87d8c9d40 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -6519,8 +6519,7 @@ void HWR_Switch(void) HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value); // Load textures - if (!gl_maptexturesloaded) - HWR_LoadMapTextures(numtextures); + HWR_LoadMapTextures(numtextures); // Create plane polygons if (!gl_maploaded && levelloaded) diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 2b72607ad..a75223554 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -147,7 +147,6 @@ extern precise_t ps_hw_batchdrawtime; extern boolean gl_init; extern boolean gl_maploaded; -extern boolean gl_maptexturesloaded; extern boolean gl_sessioncommandsadded; extern boolean gl_shadersavailable; diff --git a/src/screen.c b/src/screen.c index 2bd754ff3..675c76e3e 100644 --- a/src/screen.c +++ b/src/screen.c @@ -51,7 +51,6 @@ viddef_t vid; INT32 setmodeneeded; //video mode change needed if > 0 (the mode number to set + 1) UINT8 setrenderneeded = 0; -boolean cansetrender = true; //added : 03-02-98: default screen mode, as loaded/saved in config consvar_t cv_scr_width = CVAR_INIT ("scr_width", "640", CV_SAVE, CV_Unsigned, NULL); @@ -497,13 +496,6 @@ void SCR_ChangeRenderer(void) || (signed)rendermode == cv_renderer.value) return; - if (!cansetrender) - { - CONS_Alert(CONS_NOTICE, "You cannot change renderers at the moment.\n"); - CV_SetValue(&cv_renderer, (signed)rendermode); - return; - } - #ifdef HWRENDER // Check if OpenGL loaded successfully (or wasn't disabled) before switching to it. if ((vid.glstate == VID_GL_LIBRARY_ERROR) diff --git a/src/screen.h b/src/screen.h index 1c893ea02..539ede6d4 100644 --- a/src/screen.h +++ b/src/screen.h @@ -88,7 +88,6 @@ enum extern viddef_t vid; extern INT32 setmodeneeded; // mode number to set if needed, or 0 extern UINT8 setrenderneeded; -extern boolean cansetrender; extern double averageFPS;