From e15cca96239909f664ff17cbb66a0eea5541044a Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 17 Apr 2023 22:23:54 -0700 Subject: [PATCH] GBA Video: Fix interpolation issues with OpenGL renderer --- CHANGES | 1 + src/gba/renderers/gl.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index e76ff61c7..8358a7f33 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ Emulation fixes: - GBA SIO: Fix unconnected normal mode SIOCNT SI bit (fixes mgba.io/i/2810) - GBA SIO: Normal mode transfers with no clock should not finish (fixes mgba.io/i/2811) - GBA Timers: Cascading timers don't tick when disabled (fixes mgba.io/i/2812) + - GBA Video: Fix interpolation issues with OpenGL renderer Other fixes: - Core: Allow sending thread requests to a crashed core (fixes mgba.io/i/2784) - FFmpeg: Force lower sample rate for codecs not supporting high rates (fixes mgba.io/i/2869) diff --git a/src/gba/renderers/gl.c b/src/gba/renderers/gl.c index b6ffa2aac..4a751c706 100644 --- a/src/gba/renderers/gl.c +++ b/src/gba/renderers/gl.c @@ -289,12 +289,12 @@ static const char* const _renderMode2 = " }\n" " loadAffine(int(incoord.y), mat, offset);\n" " float y = fract(incoord.y);\n" - " float start = 0.75;\n" + " float start = 2. / 3.;\n" " if (int(incoord.y) - range.x < 4) {\n" " y = incoord.y - float(range.x);\n" - " start = 0.;\n" + " start -= 1.;\n" " }\n" - " float lin = start + y * 0.25;\n" + " float lin = start + y / 3.;\n" " vec2 mixedTransform = interpolate(mat, lin);\n" " vec2 mixedOffset = interpolate(offset, lin);\n" " int paletteEntry = fetchTile(ivec2(mixedTransform * incoord.x + mixedOffset));\n" @@ -340,12 +340,12 @@ static const char* const _renderMode35 = " }\n" " loadAffine(int(incoord.y), mat, offset);\n" " float y = fract(incoord.y);\n" - " float start = 0.75;\n" + " float start = 2. / 3.;\n" " if (int(incoord.y) - range.x < 4) {\n" " y = incoord.y - float(range.x);\n" - " start = 0.;\n" + " start -= 1.;\n" " }\n" - " float lin = start + y * 0.25;\n" + " float lin = start + y / 3.;\n" " vec2 mixedTransform = interpolate(mat, lin);\n" " vec2 mixedOffset = interpolate(offset, lin);\n" " ivec2 coord = ivec2(mixedTransform * incoord.x + mixedOffset);\n" @@ -401,12 +401,12 @@ static const char* const _renderMode4 = " }\n" " loadAffine(int(incoord.y), mat, offset);\n" " float y = fract(incoord.y);\n" - " float start = 0.75;\n" + " float start = 2. / 3.;\n" " if (int(incoord.y) - range.x < 4) {\n" " y = incoord.y - float(range.x);\n" - " start = 0.;\n" + " start -= 1.;\n" " }\n" - " float lin = start + y * 0.25;\n" + " float lin = start + y / 3.;\n" " vec2 mixedTransform = interpolate(mat, lin);\n" " vec2 mixedOffset = interpolate(offset, lin);\n" " ivec2 coord = ivec2(mixedTransform * incoord.x + mixedOffset);\n"