Remove unnecessary sprite post-processing passes

This commit is contained in:
Jeffrey Pfau 2013-10-25 00:27:42 -07:00
parent c12eca835f
commit d5291eb1b6
1 changed files with 6 additions and 1 deletions

View File

@ -531,6 +531,7 @@ static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer*
static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) { static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) {
int w; int w;
renderer->end = 0; renderer->end = 0;
int spriteLayers = 0;
if (renderer->dispcnt.objEnable) { if (renderer->dispcnt.objEnable) {
for (w = 0; w < renderer->nWindows; ++w) { for (w = 0; w < renderer->nWindows; ++w) {
renderer->start = renderer->end; renderer->start = renderer->end;
@ -543,8 +544,10 @@ static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) {
for (i = 0; i < 128; ++i) { for (i = 0; i < 128; ++i) {
struct GBAObj* sprite = &renderer->d.oam->obj[i]; struct GBAObj* sprite = &renderer->d.oam->obj[i];
if (sprite->transformed) { if (sprite->transformed) {
spriteLayers |= 1 << sprite->priority;
_preprocessTransformedSprite(renderer, &renderer->d.oam->tobj[i], y); _preprocessTransformedSprite(renderer, &renderer->d.oam->tobj[i], y);
} else if (!sprite->disable) { } else if (!sprite->disable) {
spriteLayers |= 1 << sprite->priority;
_preprocessSprite(renderer, sprite, y); _preprocessSprite(renderer, sprite, y);
} }
} }
@ -553,7 +556,9 @@ static void _drawScanline(struct GBAVideoSoftwareRenderer* renderer, int y) {
int priority; int priority;
for (priority = 0; priority < 4; ++priority) { for (priority = 0; priority < 4; ++priority) {
_postprocessSprite(renderer, priority); if (spriteLayers & (1 << priority)) {
_postprocessSprite(renderer, priority);
}
renderer->end = 0; renderer->end = 0;
for (w = 0; w < renderer->nWindows; ++w) { for (w = 0; w < renderer->nWindows; ++w) {
renderer->start = renderer->end; renderer->start = renderer->end;