all repos — mgba @ 459eaefcfcf75a177ddecab65e7896279109f7c5

mGBA Game Boy Advance Emulator

GBA Video: Clean up dead code in sprite rendering loop
Vicki Pfau vi@endrift.com
Sun, 12 May 2019 15:27:14 -0700
commit

459eaefcfcf75a177ddecab65e7896279109f7c5

parent

b176516c36fdadb7e068e0624ec5afc5fad7fdec

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

jump to
M CHANGESCHANGES

@@ -56,6 +56,7 @@ - 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 0.7.1: (2019-02-24) Bugfixes:
M src/gba/renderers/software-obj.csrc/gba/renderers/software-obj.c

@@ -62,25 +62,17 @@ #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) { \ - 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; \ - } \ + if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && tileData) { \ + renderer->spriteLayer[outX] = palette[tileData] | flags; \ } #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) { \ - 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; \ - } \ + if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && tileData) { \ + unsigned color = (renderer->row[outX] & FLAG_OBJWIN) ? objwinPalette[tileData] : palette[tileData]; \ + renderer->spriteLayer[outX] = color | flags; \ } #define SPRITE_DRAW_PIXEL_16_OBJWIN(localX) \

@@ -97,25 +89,17 @@ #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) { \ - 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; \ - } \ + if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && tileData) { \ + renderer->spriteLayer[outX] = palette[tileData] | flags; \ } #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) { \ - 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; \ - } \ + if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && tileData) { \ + unsigned color = (renderer->row[outX] & FLAG_OBJWIN) ? objwinPalette[tileData] : palette[tileData]; \ + renderer->spriteLayer[outX] = color | flags; \ } #define SPRITE_DRAW_PIXEL_256_OBJWIN(localX) \