From ee9c9e283945e4cd461c2f06da337688e6dd890b Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 14 Jul 2026 11:28:40 +0200 Subject: [PATCH] hack: fix paletterender stuff not applying to screenshots/gifs when using downsampling fbo this sucks but the final screen texture with the palette render postprocess step will not be in the downsample fbo so we have to redraw it there with the postprocess step...... this is still better than drawing another screen texture when using paletterender which costs perf --- src/hardware/r_opengl/r_opengl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index aff722773..0c04beb09 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1465,6 +1465,19 @@ void GL_ReadScreenTexture(int tex, UINT8 *restrict dest, INT32 scale) if (tex != HWD_SCREENTEXTURE_GENERIC2) GL_DrawScreenTexture(tex, NULL, 0); +#ifdef USE_FBO_OGL + // FIXME: this is incredibly stupid + // but the final screen texture will NOT be drawn in the downsample fbo + if (tex == HWD_SCREENTEXTURE_GENERIC2 && + UseScreenFBO() && HWR_ShouldUsePaletteRendering()) + { + GL_SetShader(HWR_GetShaderFromTarget(SHADER_PALETTE_POSTPROCESS)); + GL_EnableShader(); + GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0); + GL_UnSetShader(); + } +#endif + image = malloc(screen_width*screen_height*3); pglPixelStorei(GL_PACK_ALIGNMENT, 1); pglReadPixels(0, 0, screen_width, screen_height, GL_RGB, GL_UNSIGNED_BYTE, image);