From 09ccf5403eb0a0d85fa119c612b9070fe8807818 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 10 Jun 2019 10:50:14 -0700 Subject: [PATCH] GBA Video: Fix GL mode 0 y wrapping --- src/gba/renderers/gl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gba/renderers/gl.c b/src/gba/renderers/gl.c index 72ddd1d8c..a54e0b028 100644 --- a/src/gba/renderers/gl.c +++ b/src/gba/renderers/gl.c @@ -146,8 +146,12 @@ static const char* const _renderMode0 = " coord.y -= coord.y % mosaic.y;\n" " }\n" " coord += (ivec2(0x3FF, 0x3FF000) & offset[int(texCoord.y)]) >> ivec2(0, 12);\n" + " ivec2 wrap = ivec2(255, 511);\n" " if (size == 3) {\n" " coord.y += (coord.y & 256) << 1;\n" + " wrap.y = 1023;\n" + " } else if (size == 0) {\n" + " wrap.y = 255;\n" " }\n" " if (size != 2) {\n" " coord.y &= ~256;\n" @@ -155,7 +159,7 @@ static const char* const _renderMode0 = " if ((size & 1) == 1) {\n" " coord.y += coord.x & 256;\n" " }\n" - " coord &= ivec2(255, 1023);\n" + " coord &= wrap;\n" " int mapAddress = screenBase + (coord.x >> 3) + (coord.y >> 3) * 32;\n" " vec4 map = texelFetch(vram, ivec2(mapAddress & 255, mapAddress >> 8), 0);\n" " int tileFlags = int(map.g * 15.9);\n"