Skip to content

Commit

Permalink
Revert "GBA Video: Clean up dead code in sprite rendering loop"
Browse files Browse the repository at this point in the history
This reverts commit 7007879.
  • Loading branch information
endrift committed May 25, 2019
1 parent 133bb24 commit d927ac1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
1 change: 0 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Misc:
- Qt: Add missing HEVC NVENC option (fixes mgba.io/i/1323)
- Qt: Improve camera initialization
- Vita: Improved frame drawing speed
- GBA Video: Clean up dead code in sprite rendering loop

0.7.1: (2019-02-24)
Bugfixes:
Expand Down
36 changes: 26 additions & 10 deletions src/gba/renderers/software-obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,25 @@
LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \
tileData = (tileData >> ((localX & 3) << 2)) & 0xF; \
current = renderer->spriteLayer[outX]; \
if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && 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_UNWRITTEN) == FLAG_UNWRITTEN && 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) \
Expand All @@ -107,17 +115,25 @@
LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \
tileData = (tileData >> ((localX & 1) << 3)) & 0xFF; \
current = renderer->spriteLayer[outX]; \
if ((current & FLAG_UNWRITTEN) == FLAG_UNWRITTEN && 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_UNWRITTEN) == FLAG_UNWRITTEN && 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) \
Expand Down

0 comments on commit d927ac1

Please sign in to comment.