GBA Video: Fix mode 4 transparency in OpenGL (fixes #1907)

This commit is contained in:
Vicki Pfau 2020-10-11 16:37:49 -07:00
parent c3d4f68dc5
commit d830e50557
2 changed files with 6 additions and 2 deletions

View File

@ -12,6 +12,7 @@ Emulation fixes:
- GBA Video: Fix rare regression blending semitransparent sprites (fixes mgba.io/i/1876)
- GBA Video: Do not affect OBJ pixel priority when writing OBJWIN (fixes mgba.io/i/1890)
- GBA Video: Fix deferred blending when OBJWIN matches window (fixes mgba.io/i/1905)
- GBA Video: Fix mode 4 transparency in OpenGL (fixes mgba.io/i/1907)
Other fixes:
- 3DS: Redo video sync to be more precise
- 3DS: Fix crash with libctru 2.0 when exiting

View File

@ -410,8 +410,11 @@ static const char* const _renderMode4 =
" }\n"
" int address = charBase + (coord.x >> 8) + (coord.y >> 8) * size.x;\n"
" vec4 twoEntries = texelFetch(vram, ivec2((address >> 1) & 255, address >> 9), 0);\n"
" ivec2 entry = ivec2(twoEntries[3 - 2 * (address & 1)] * 15.9, twoEntries[2 - 2 * (address & 1)] * 15.9);\n"
" int paletteEntry = palette[entry.y * 16 + entry.x];\n"
" int entry = int(twoEntries[2 - 2 * (address & 1)] * 15.9) * 16 + int(twoEntries[3 - 2 * (address & 1)] * 15.9);\n"
" if (entry == 0) {\n"
" discard;\n"
" }\n"
" int paletteEntry = palette[entry];\n"
" color = vec4(PALETTE_ENTRY(paletteEntry), 1.);\n"
" flags = inflags;\n"
"}";