GBA Video: Fix deferred blending when OBJWIN matches window (fixes #1905)

This commit is contained in:
Vicki Pfau 2020-10-05 00:25:00 -07:00
parent 830aea2f57
commit 3f10823ef5
2 changed files with 11 additions and 9 deletions

View File

@ -48,6 +48,7 @@ Emulation fixes:
- GBA Video: Fix rare regression blending semitransparent sprites (fixes mgba.io/i/1876)
- GBA Video: Emulate sprite cycle limits in OpenGL renderer (fixes mgba.io/i/1635)
- GBA Video: Do not affect OBJ pixel priority when writing OBJWIN (fixes mgba.io/i/1890)
- GBA Video: Fix deferred blending when OBJWIN matches window (fixes mgba.io/i/1905)
- SM83: Emulate HALT bug
Other fixes:
- 3DS: Redo video sync to be more precise

View File

@ -644,17 +644,18 @@ static void GBAVideoSoftwareRendererDrawScanline(struct GBAVideoRenderer* render
}
if (softwareRenderer->forceTarget1 && (softwareRenderer->blendEffect == BLEND_DARKEN || softwareRenderer->blendEffect == BLEND_BRIGHTEN)) {
x = 0;
uint32_t mask = FLAG_REBLEND | FLAG_IS_BACKGROUND;
uint32_t match = FLAG_REBLEND;
if (GBARegisterDISPCNTIsObjwinEnable(softwareRenderer->dispcnt)) {
mask |= FLAG_OBJWIN;
if (GBAWindowControlIsBlendEnable(softwareRenderer->objwin.packed)) {
match |= FLAG_OBJWIN;
}
}
for (w = 0; w < softwareRenderer->nWindows; ++w) {
int end = softwareRenderer->windows[w].endX;
if (!GBAWindowControlIsBlendEnable(softwareRenderer->windows[w].control.packed)) {
uint32_t mask = FLAG_REBLEND | FLAG_IS_BACKGROUND;
uint32_t match = FLAG_REBLEND;
bool objBlend = GBAWindowControlIsBlendEnable(softwareRenderer->objwin.packed);
bool winBlend = GBAWindowControlIsBlendEnable(softwareRenderer->windows[w].control.packed);
if (GBARegisterDISPCNTIsObjwinEnable(softwareRenderer->dispcnt) && objBlend != winBlend) {
mask |= FLAG_OBJWIN;
if (objBlend) {
match |= FLAG_OBJWIN;
}
} else if (!winBlend) {
x = end;
continue;
}