all repos — mgba @ d77793231dff03467baf775ad59fad126832b609

mGBA Game Boy Advance Emulator

GBA Video: Minor sprite optimization
Jeffrey Pfau jeffrey@endrift.com
Sat, 22 Oct 2016 23:40:01 -0700
commit

d77793231dff03467baf775ad59fad126832b609

parent

0c665cf5a3d3067a6377a2fef5bffc484bbbd0c3

1 files changed, 2 insertions(+), 2 deletions(-)

jump to
M src/gba/renderers/software-obj.csrc/gba/renderers/software-obj.c

@@ -65,7 +65,7 @@ SPRITE_DRAW_PIXEL_ ## DEPTH ## _ ## TYPE(localX); \

} #define SPRITE_XBASE_16(localX) unsigned xBase = (localX & ~0x7) * 4 + ((localX >> 1) & 2); -#define SPRITE_YBASE_16(localY) unsigned yBase = (localY & ~0x7) * (GBARegisterDISPCNTIsObjCharacterMapping(renderer->dispcnt) ? width >> 1 : 0x80) + (localY & 0x7) * 4; +#define SPRITE_YBASE_16(localY) unsigned yBase = (localY & ~0x7) * stride + (localY & 0x7) * 4; #define SPRITE_DRAW_PIXEL_16_NORMAL(localX) \ LOAD_16(tileData, ((yBase + charBase + xBase) & 0x7FFE), vramBase); \

@@ -181,7 +181,7 @@ }

} int inY = y - (int) GBAObjAttributesAGetY(sprite->a); - int stride = GBARegisterDISPCNTIsObjCharacterMapping(renderer->dispcnt) ? width : 0x80; + int stride = GBARegisterDISPCNTIsObjCharacterMapping(renderer->dispcnt) ? (width >> !GBAObjAttributesAIs256Color(sprite->a)) : 0x80; uint32_t current; if (GBAObjAttributesAIsTransformed(sprite->a)) {