mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Optimize when BLD* registers are written frequently
This commit is contained in:
parent
ee5dbd9f82
commit
1bb496d0fe
1
CHANGES
1
CHANGES
|
@ -63,6 +63,7 @@ Misc:
|
||||||
- GBA, GB: ROM is now unloaded if a patch is applied
|
- GBA, GB: ROM is now unloaded if a patch is applied
|
||||||
- Util: Add 8-bit PNG write support
|
- Util: Add 8-bit PNG write support
|
||||||
- Qt: Rename "Resample video" option to "Bilinear filtering"
|
- Qt: Rename "Resample video" option to "Bilinear filtering"
|
||||||
|
- GBA Video: Optimize when BLD* registers are written frequently
|
||||||
|
|
||||||
0.5.2: (2016-12-31)
|
0.5.2: (2016-12-31)
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
|
@ -126,6 +126,7 @@ struct GBAVideoSoftwareRenderer {
|
||||||
unsigned target1Bd;
|
unsigned target1Bd;
|
||||||
unsigned target2Obj;
|
unsigned target2Obj;
|
||||||
unsigned target2Bd;
|
unsigned target2Bd;
|
||||||
|
bool blendDirty;
|
||||||
enum BlendEffect blendEffect;
|
enum BlendEffect blendEffect;
|
||||||
color_t normalPalette[512];
|
color_t normalPalette[512];
|
||||||
color_t variantPalette[512];
|
color_t variantPalette[512];
|
||||||
|
|
|
@ -97,6 +97,7 @@ static void GBAVideoSoftwareRendererReset(struct GBAVideoRenderer* renderer) {
|
||||||
LOAD_16(entry, i, softwareRenderer->d.palette);
|
LOAD_16(entry, i, softwareRenderer->d.palette);
|
||||||
GBAVideoSoftwareRendererWritePalette(renderer, i, entry);
|
GBAVideoSoftwareRendererWritePalette(renderer, i, entry);
|
||||||
}
|
}
|
||||||
|
softwareRenderer->blendDirty = false;
|
||||||
_updatePalettes(softwareRenderer);
|
_updatePalettes(softwareRenderer);
|
||||||
|
|
||||||
softwareRenderer->blda = 0;
|
softwareRenderer->blda = 0;
|
||||||
|
@ -261,11 +262,14 @@ static uint16_t GBAVideoSoftwareRendererWriteVideoRegister(struct GBAVideoRender
|
||||||
value &= 0x1F1F;
|
value &= 0x1F1F;
|
||||||
break;
|
break;
|
||||||
case REG_BLDY:
|
case REG_BLDY:
|
||||||
softwareRenderer->bldy = value & 0x1F;
|
value &= 0x1F;
|
||||||
if (softwareRenderer->bldy > 0x10) {
|
if (value > 0x10) {
|
||||||
softwareRenderer->bldy = 0x10;
|
value = 0x10;
|
||||||
|
}
|
||||||
|
if (softwareRenderer->bldy != value) {
|
||||||
|
softwareRenderer->bldy = value;
|
||||||
|
softwareRenderer->blendDirty = true;
|
||||||
}
|
}
|
||||||
_updatePalettes(softwareRenderer);
|
|
||||||
break;
|
break;
|
||||||
case REG_WIN0H:
|
case REG_WIN0H:
|
||||||
softwareRenderer->winN[0].h.end = value;
|
softwareRenderer->winN[0].h.end = value;
|
||||||
|
@ -515,6 +519,10 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
|
||||||
}
|
}
|
||||||
|
|
||||||
GBAVideoSoftwareRendererUpdateDISPCNT(softwareRenderer);
|
GBAVideoSoftwareRendererUpdateDISPCNT(softwareRenderer);
|
||||||
|
if (softwareRenderer->blendDirty) {
|
||||||
|
_updatePalettes(softwareRenderer);
|
||||||
|
softwareRenderer->blendDirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
int w;
|
int w;
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -702,7 +710,7 @@ static void GBAVideoSoftwareRendererWriteBLDCNT(struct GBAVideoSoftwareRenderer*
|
||||||
renderer->target2Bd = GBARegisterBLDCNTGetTarget2Bd(value);
|
renderer->target2Bd = GBARegisterBLDCNTGetTarget2Bd(value);
|
||||||
|
|
||||||
if (oldEffect != renderer->blendEffect) {
|
if (oldEffect != renderer->blendEffect) {
|
||||||
_updatePalettes(renderer);
|
renderer->blendDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue