all repos — mgba @ 1bb496d0feee858eb964c0426ca6a97d6dc1aba6

mGBA Game Boy Advance Emulator

GBA Video: Optimize when BLD* registers are written frequently
Vicki Pfau vi@endrift.com
Fri, 03 Feb 2017 16:50:05 -0800
commit

1bb496d0feee858eb964c0426ca6a97d6dc1aba6

parent

ee5dbd9f82c768df23afbd5262b58496a2ec8d78

3 files changed, 15 insertions(+), 5 deletions(-)

jump to
M CHANGESCHANGES

@@ -63,6 +63,7 @@ - OpenGL: Add xBR-lv2 shader

- GBA, GB: ROM is now unloaded if a patch is applied - Util: Add 8-bit PNG write support - Qt: Rename "Resample video" option to "Bilinear filtering" + - GBA Video: Optimize when BLD* registers are written frequently 0.5.2: (2016-12-31) Bugfixes:
M include/mgba/internal/gba/renderers/video-software.hinclude/mgba/internal/gba/renderers/video-software.h

@@ -126,6 +126,7 @@ unsigned target1Obj;

unsigned target1Bd; unsigned target2Obj; unsigned target2Bd; + bool blendDirty; enum BlendEffect blendEffect; color_t normalPalette[512]; color_t variantPalette[512];
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -97,6 +97,7 @@ uint16_t entry;

LOAD_16(entry, i, softwareRenderer->d.palette); GBAVideoSoftwareRendererWritePalette(renderer, i, entry); } + softwareRenderer->blendDirty = false; _updatePalettes(softwareRenderer); softwareRenderer->blda = 0;

@@ -261,11 +262,14 @@ }

value &= 0x1F1F; break; case REG_BLDY: - softwareRenderer->bldy = value & 0x1F; - if (softwareRenderer->bldy > 0x10) { - softwareRenderer->bldy = 0x10; + value &= 0x1F; + if (value > 0x10) { + value = 0x10; } - _updatePalettes(softwareRenderer); + if (softwareRenderer->bldy != value) { + softwareRenderer->bldy = value; + softwareRenderer->blendDirty = true; + } break; case REG_WIN0H: softwareRenderer->winN[0].h.end = value;

@@ -515,6 +519,10 @@ softwareRenderer->windows[0].control.packed = 0xFF;

} GBAVideoSoftwareRendererUpdateDISPCNT(softwareRenderer); + if (softwareRenderer->blendDirty) { + _updatePalettes(softwareRenderer); + softwareRenderer->blendDirty = false; + } int w; x = 0;

@@ -702,7 +710,7 @@ renderer->target2Obj = GBARegisterBLDCNTGetTarget2Obj(value);

renderer->target2Bd = GBARegisterBLDCNTGetTarget2Bd(value); if (oldEffect != renderer->blendEffect) { - _updatePalettes(renderer); + renderer->blendDirty = true; } }