GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes #1572)
Vicki Pfau vi@endrift.com
Sun, 10 Nov 2019 20:42:36 -0800
2 files changed,
13 insertions(+),
12 deletions(-)
M
CHANGES
→
CHANGES
@@ -90,6 +90,7 @@ Emulation fixes:
- ARM: Fix STR writeback pipeline stage - ARM: Partially fix LDM/STM writeback with empty register list - GBA DMA: Fix case where DMAs could get misaligned (fixes mgba.io/i/1092) + - GBA Video: Fix OpenGL renderer 512x512 backgrounds (fixes mgba.io/i/1572) Other fixes: - 3DS: Fix screen darkening (fixes mgba.io/i/1562) - Vita: Fix analog controls (fixes mgba.io/i/1554)
M
src/gba/renderers/gl.c
→
src/gba/renderers/gl.c
@@ -145,21 +145,21 @@ " }\n"
" if (mosaic.y > 1) {\n" " 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" - " }\n" + " coord += (ivec2(0x1FF, 0x1FF000) & offset[int(texCoord.y)]) >> ivec2(0, 12);\n" + " ivec2 wrap = ivec2(255, 255);\n" + " int doty = 0;\n" " if ((size & 1) == 1) {\n" - " coord.y += coord.x & 256;\n" + " wrap.x = 511;\n" + " ++doty;\n" + " }\n" + " if ((size & 2) == 2) {\n" + " wrap.y = 511;\n" + " ++doty;\n" " }\n" " coord &= wrap;\n" + " wrap = coord & 256;\n" + " coord &= 255;\n" + " coord.y += wrap.x + wrap.y * doty;\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"