From 0c02f2798a670085295755727923c34bb1715803 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 29 May 2022 18:49:40 -0700 Subject: [PATCH] GBA Video: Fix sprites with mid-frame palette changes in GL (fixes #2476) --- CHANGES | 1 + src/gba/renderers/gl.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 34020c283..ff795586a 100644 --- a/CHANGES +++ b/CHANGES @@ -37,6 +37,7 @@ Emulation fixes: - GBA Video: Ignore horizontally off-screen sprite timing (fixes mgba.io/i/2391) - GBA Video: Fix Hblank timing (fixes mgba.io/i/2131, mgba.io/i/2310) - GBA Video: Fix rare crash in modes 3-5 + - GBA Video: Fix sprites with mid-frame palette changes in GL (fixes mgba.io/i/2476) Other fixes: - Core: Don't attempt to restore rewind diffs past start of rewind - Core: Fix the runloop resuming after a game has crashed (fixes mgba.io/i/2451) diff --git a/src/gba/renderers/gl.c b/src/gba/renderers/gl.c index e45b754ff..02374d8e4 100644 --- a/src/gba/renderers/gl.c +++ b/src/gba/renderers/gl.c @@ -462,7 +462,7 @@ static const char* const _renderObj = " discard;\n" " }\n" " int paletteEntry = renderTile((coord.x >> 3) + (coord.y >> 3) * stride, localPalette, coord & 7);\n" - " color = texelFetch(palette, ivec2(paletteEntry + 256, coord.y), 0);\n" + " color = texelFetch(palette, ivec2(paletteEntry + 256, int(texCoord.y) + mosaic.w), 0);\n" " flags = inflags;\n" " gl_FragDepth = float(flags.x) / 16.;\n" " window = ivec4(objwin, 0);\n"