From ef076b457691c012aae07818ea2e692fbc0bb622 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 2 Mar 2024 02:15:28 +0100 Subject: [PATCH] unhack palrendering screentex stuff --- src/hardware/r_opengl/r_opengl.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 1cb3153a4..d1e04f331 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -829,12 +829,15 @@ EXPORT void HWRAPI(SetShader) (int slot) EXPORT void HWRAPI(UnSetShader) (void) { - gl_shaderstate.current = NULL; - gl_shaderstate.type = 0; - gl_shaderstate.program = 0; + if (gl_shadersenabled) // don't repeatedly call glUseProgram if not needed + { + gl_shaderstate.current = NULL; + gl_shaderstate.type = 0; + gl_shaderstate.program = 0; - if (pglUseProgram) - pglUseProgram(0); + if (pglUseProgram) + pglUseProgram(0); + } gl_shadersenabled = false; } @@ -3253,7 +3256,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, int width, int height) pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); if (HWR_ShouldUsePaletteRendering()) - UnSetShader(); + pglUseProgram(0); tex_downloaded = screenTextures[tex]; }