all repos — mgba @ d5291eb1b65c29b629c8d10d65d6cdf2d4449e48

mGBA Game Boy Advance Emulator

Remove unnecessary sprite post-processing passes
Jeffrey Pfau jeffrey@endrift.com
Fri, 25 Oct 2013 00:27:42 -0700
commit

d5291eb1b65c29b629c8d10d65d6cdf2d4449e48

parent

c12eca835f8f8c2550fd17ef3870ebc511fe6e23

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

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

@@ -531,6 +531,7 @@

static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) { int w; renderer->end = 0; + int spriteLayers = 0; if (renderer->dispcnt.objEnable) { for (w = 0; w < renderer->nWindows; ++w) { renderer->start = renderer->end;

@@ -543,8 +544,10 @@ int i;

for (i = 0; i < 128; ++i) { struct GBAObj* sprite = &renderer->d.oam->obj[i]; if (sprite->transformed) { + spriteLayers |= 1 << sprite->priority; _preprocessTransformedSprite(renderer, &renderer->d.oam->tobj[i], y); } else if (!sprite->disable) { + spriteLayers |= 1 << sprite->priority; _preprocessSprite(renderer, sprite, y); } }

@@ -553,7 +556,9 @@ }

int priority; for (priority = 0; priority < 4; ++priority) { - _postprocessSprite(renderer, priority); + if (spriteLayers & (1 << priority)) { + _postprocessSprite(renderer, priority); + } renderer->end = 0; for (w = 0; w < renderer->nWindows; ++w) { renderer->start = renderer->end;