all repos — mgba @ 3f10823ef560e2c492a6ae5aa885155e35b92d0c

mGBA Game Boy Advance Emulator

GBA Video: Fix deferred blending when OBJWIN matches window (fixes #1905)
Vicki Pfau vi@endrift.com
Mon, 05 Oct 2020 00:25:00 -0700
commit

3f10823ef560e2c492a6ae5aa885155e35b92d0c

parent

830aea2f57c37a69c23b7e3c2ece59c4a4c36567

2 files changed, 11 insertions(+), 9 deletions(-)

jump to
M CHANGESCHANGES

@@ -48,6 +48,7 @@ - GBA Video: Implement green swap (fixes mgba.io/i/1609)

- 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
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -644,17 +644,18 @@ }

} 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; }