From 6640146521a740b446e9ed2fa04bebe73bc9ca32 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 c3b0ecc14..311e5f533 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1480,6 +1480,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);