From b83016f492c94f31d6feeba983c787d1e24d06e4 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 28 Oct 2024 07:21:03 +0100 Subject: [PATCH] dont always call HWR_Startup again --- src/hardware/hw_main.c | 6 ++++-- src/sdl/ogl_sdl.c | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 2ff6d47f8..500663955 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -263,7 +263,8 @@ static void CV_glframebuffer_OnChange(void) if (cv_glframebuffer.value != 0 && cv_glscreentextures.value != 2) // screen FBO needs screen textures CV_SetValue(&cv_glframebuffer, 0); - HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value); + if (supportFBO) + HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value); I_DownSample(); RefreshOGLSDLSurface(); M_UpdateOGLMenu(); @@ -5468,7 +5469,8 @@ void HWR_Startup(void) HWR_TogglePaletteRendering(); #ifdef USE_FBO_OGL - HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value); + if (supportFBO) + HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value); #endif if (msaa) diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index a9f4a39cd..b650cbec1 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -112,10 +112,11 @@ boolean LoadGL(void) \return if true, changed video mode */ +static boolean first_init = false; + boolean OglSdlSurface(INT32 w, INT32 h) { INT32 cbpp = cv_scr_depth.value < 16 ? 16 : cv_scr_depth.value; - static boolean first_init = false; const char *gllogdir = NULL; oglflags = 0; @@ -180,7 +181,6 @@ boolean OglSdlSurface(INT32 w, INT32 h) #endif #endif } - first_init = true; if (cv_vidwait.value) { @@ -227,9 +227,12 @@ boolean OglSdlSurface(INT32 w, INT32 h) } #endif - HWR_Startup(); + if (!first_init) + HWR_Startup(); textureformatGL = cbpp > 16 ? GL_RGBA : GL_RGB5_A1; + first_init = true; + return true; }