From dbdd5b8b6ea63e8caee27ded9b0b619bfb8dfae8 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 27 Nov 2024 22:34:48 +0100 Subject: [PATCH] only apply palrender postprocess shader once --- src/hardware/hw_drv.h | 2 +- src/hardware/hw_main.c | 4 ++-- src/hardware/hw_main.h | 2 +- src/hardware/r_opengl/r_opengl.c | 6 +++--- src/sdl/ogl_sdl.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hardware/hw_drv.h b/src/hardware/hw_drv.h index 8376ab405..335940142 100644 --- a/src/hardware/hw_drv.h +++ b/src/hardware/hw_drv.h @@ -60,7 +60,7 @@ EXPORT void HWRAPI(FlushScreenTextures) (void); EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd); EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags); EXPORT void HWRAPI(MakeScreenTexture) (int tex); -EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height); +EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height, boolean useshader); EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c index 53df1ce5f..203c62432 100644 --- a/src/hardware/hw_main.c +++ b/src/hardware/hw_main.c @@ -5626,9 +5626,9 @@ void HWR_MakeScreenFinalTexture(void) HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2); } -void HWR_DrawScreenFinalTexture(INT32 width, INT32 height) +void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader) { - HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height); + HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader); } #endif // HWRENDER diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index daa837e10..8d4228a26 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -131,7 +131,7 @@ void HWR_DrawIntermissionBG(void); void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize); void HWR_MakeScreenFinalTexture(void); -void HWR_DrawScreenFinalTexture(INT32 width, INT32 height); +void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader); // hw_main.c: Segs void HWR_ProcessSeg(void); // Sort of like GLWall::Process in GZDoom diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index df99f4437..d918addef 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -3396,7 +3396,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (int tex) tex_downloaded = screenTextures[tex]; } -EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height) +EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height, boolean useshader) { float xfix, yfix; float origaspect, newaspect; @@ -3463,7 +3463,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height) pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]); - if (HWR_ShouldUsePaletteRendering()) + if (useshader) pglUseProgram(gl_shaders[SHADER_PALETTE_POSTPROCESS].program); // palette postprocess shader pglColor4ubv(white); @@ -3473,7 +3473,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height) pglDrawArrays(GL_TRIANGLE_FAN, 0, 4); - if (HWR_ShouldUsePaletteRendering()) + if (useshader) pglUseProgram(0); tex_downloaded = screenTextures[tex]; diff --git a/src/sdl/ogl_sdl.c b/src/sdl/ogl_sdl.c index 3d57b1f14..e1e484bcc 100644 --- a/src/sdl/ogl_sdl.c +++ b/src/sdl/ogl_sdl.c @@ -258,7 +258,7 @@ void OglSdlFinishUpdate(boolean waitvbl) GLFramebuffer_Unbind(); #endif - HWR_DrawScreenFinalTexture(sdlw, sdlh); + HWR_DrawScreenFinalTexture(sdlw, sdlh, HWR_ShouldUsePaletteRendering()); #ifdef USE_FBO_OGL if (UseScreenFBO()) @@ -276,7 +276,7 @@ void OglSdlFinishUpdate(boolean waitvbl) && (!UseScreenFBO()) #endif ) - HWR_DrawScreenFinalTexture(realwidth, realheight); + HWR_DrawScreenFinalTexture(realwidth, realheight, false); } EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette)