Tear out counter-productive optimization
Jeffrey Pfau jeffrey@endrift.com
Thu, 24 Oct 2013 00:21:59 -0700
2 files changed,
7 insertions(+),
26 deletions(-)
M
src/gba/renderers/video-software.c
→
src/gba/renderers/video-software.c
@@ -63,7 +63,6 @@ softwareRenderer->target2Bd = 0;
softwareRenderer->blendEffect = BLEND_NONE; memset(softwareRenderer->normalPalette, 0, sizeof(softwareRenderer->normalPalette)); memset(softwareRenderer->variantPalette, 0, sizeof(softwareRenderer->variantPalette)); - memset(softwareRenderer->enabledBitmap, 0, sizeof(softwareRenderer->enabledBitmap)); softwareRenderer->blda = 0; softwareRenderer->bldb = 0;@@ -273,13 +272,6 @@ }
static void GBAVideoSoftwareRendererWriteOAM(struct GBAVideoRenderer* renderer, uint32_t oam) { struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; - if ((oam & 0x3) != 0x3) { - oam >>= 2; - struct GBAObj* sprite = &renderer->oam->obj[oam]; - int enabled = sprite->transformed || !sprite->disable; - enabled <<= (oam & 0x1F); - softwareRenderer->enabledBitmap[oam >> 5] = (softwareRenderer->enabledBitmap[oam >> 5] & ~(1 << (oam & 0x1F))) | enabled; - } } static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) {@@ -545,22 +537,13 @@ renderer->currentWindow = renderer->windows[w].control;
if (!renderer->currentWindow.objEnable) { continue; } - int i, j; - for (j = 0; j < 4; ++j) { - uint32_t bitmap = renderer->enabledBitmap[j]; - if (!bitmap) { - continue; - } - for (i = j * 32; i < (j + 1) * 32; ++i) { - if (bitmap & 1) { - struct GBAObj* sprite = &renderer->d.oam->obj[i]; - if (sprite->transformed) { - _preprocessTransformedSprite(renderer, &renderer->d.oam->tobj[i], y); - } else { - _preprocessSprite(renderer, sprite, y); - } - } - bitmap >>= 1; + int i; + for (i = 0; i < 128; ++i) { + struct GBAObj* sprite = &renderer->d.oam->obj[i]; + if (sprite->transformed) { + _preprocessTransformedSprite(renderer, &renderer->d.oam->tobj[i], y); + } else if (!sprite->disable) { + _preprocessSprite(renderer, sprite, y); } } }
M
src/gba/renderers/video-software.h
→
src/gba/renderers/video-software.h
@@ -144,8 +144,6 @@ struct GBAVideoSoftwareBackground bg[4];
int start; int end; - - uint32_t enabledBitmap[4]; }; void GBAVideoSoftwareRendererCreate(struct GBAVideoSoftwareRenderer* renderer);