all repos — mgba @ c5c742dbfd76a5a6ac6083bee395a07e270c7dbd

mGBA Game Boy Advance Emulator

Revert "GBA Video: Clean up dead code in sprite rendering loop"

This reverts commit 459eaefcfcf75a177ddecab65e7896279109f7c5.
Vicki Pfau vi@endrift.com
Mon, 10 Jun 2019 10:44:57 -0700
commit

c5c742dbfd76a5a6ac6083bee395a07e270c7dbd

parent

faef25b0d8772c78e8a5e25380576c30117789b7

2 files changed, 26 insertions(+), 11 deletions(-)

jump to
M CHANGESCHANGES

@@ -45,7 +45,6 @@ - GBA BIOS: Add timings for HLE BIOS math functions (fixes mgba.io/i/1396)

- Debugger: Make tracing compatible with breakpoints/watchpoints - Debugger: Print breakpoint/watchpoint number when inserting - Qt: Open a message box for Qt frontend errors - - GBA Video: Clean up dead code in sprite rendering loop - FFmpeg: Support audio-only recording - Qt: Increase maximum magnifications and scaling - Qt: Add native FPS button to settings view
M src/gba/renderers/software-obj.csrc/gba/renderers/software-obj.c

@@ -80,17 +80,25 @@ #define SPRITE_DRAW_PIXEL_16_NORMAL(localX) \

LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \ tileData = (tileData >> ((localX & 3) << 2)) & 0xF; \ current = renderer->spriteLayer[outX]; \ - if ((current & FLAG_ORDER_MASK) > flags && tileData) { \ - renderer->spriteLayer[outX] = palette[tileData] | flags; \ + if ((current & FLAG_ORDER_MASK) > flags) { \ + if (tileData) { \ + renderer->spriteLayer[outX] = palette[tileData] | flags; \ + } else if (current != FLAG_UNWRITTEN) { \ + renderer->spriteLayer[outX] = (current & ~FLAG_ORDER_MASK) | GBAObjAttributesCGetPriority(sprite->c) << OFFSET_PRIORITY; \ + } \ } #define SPRITE_DRAW_PIXEL_16_NORMAL_OBJWIN(localX) \ LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \ tileData = (tileData >> ((localX & 3) << 2)) & 0xF; \ current = renderer->spriteLayer[outX]; \ - if ((current & FLAG_ORDER_MASK) > flags && tileData) { \ - unsigned color = (renderer->row[outX] & FLAG_OBJWIN) ? objwinPalette[tileData] : palette[tileData]; \ - renderer->spriteLayer[outX] = color | flags; \ + if ((current & FLAG_ORDER_MASK) > flags) { \ + if (tileData) { \ + unsigned color = (renderer->row[outX] & FLAG_OBJWIN) ? objwinPalette[tileData] : palette[tileData]; \ + renderer->spriteLayer[outX] = color | flags; \ + } else if (current != FLAG_UNWRITTEN) { \ + renderer->spriteLayer[outX] = (current & ~FLAG_ORDER_MASK) | GBAObjAttributesCGetPriority(sprite->c) << OFFSET_PRIORITY; \ + } \ } #define SPRITE_DRAW_PIXEL_16_OBJWIN(localX) \

@@ -107,17 +115,25 @@ #define SPRITE_DRAW_PIXEL_256_NORMAL(localX) \

LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \ tileData = (tileData >> ((localX & 1) << 3)) & 0xFF; \ current = renderer->spriteLayer[outX]; \ - if ((current & FLAG_ORDER_MASK) > flags && tileData) { \ - renderer->spriteLayer[outX] = palette[tileData] | flags; \ + if ((current & FLAG_ORDER_MASK) > flags) { \ + if (tileData) { \ + renderer->spriteLayer[outX] = palette[tileData] | flags; \ + } else if (current != FLAG_UNWRITTEN) { \ + renderer->spriteLayer[outX] = (current & ~FLAG_ORDER_MASK) | GBAObjAttributesCGetPriority(sprite->c) << OFFSET_PRIORITY; \ + } \ } #define SPRITE_DRAW_PIXEL_256_NORMAL_OBJWIN(localX) \ LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \ tileData = (tileData >> ((localX & 1) << 3)) & 0xFF; \ current = renderer->spriteLayer[outX]; \ - if ((current & FLAG_ORDER_MASK) > flags && tileData) { \ - unsigned color = (renderer->row[outX] & FLAG_OBJWIN) ? objwinPalette[tileData] : palette[tileData]; \ - renderer->spriteLayer[outX] = color | flags; \ + if ((current & FLAG_ORDER_MASK) > flags) { \ + if (tileData) { \ + unsigned color = (renderer->row[outX] & FLAG_OBJWIN) ? objwinPalette[tileData] : palette[tileData]; \ + renderer->spriteLayer[outX] = color | flags; \ + } else if (current != FLAG_UNWRITTEN) { \ + renderer->spriteLayer[outX] = (current & ~FLAG_ORDER_MASK) | GBAObjAttributesCGetPriority(sprite->c) << OFFSET_PRIORITY; \ + } \ } #define SPRITE_DRAW_PIXEL_256_OBJWIN(localX) \