GBA Video: Fix deferred blending when OBJWIN matches window (fixes #1905)
Vicki Pfau vi@endrift.com
Mon, 05 Oct 2020 00:25:00 -0700
2 files changed,
11 insertions(+),
9 deletions(-)
M
CHANGES
→
CHANGES
@@ -11,6 +11,7 @@ - GBA Video: Invalidate map cache when modifying BGCNT (fixes mgba.io/i/1846)
- GBA Video: Don't draw sprites using unmapped VRAM in GL renderer (fixes mgba.io/i/1865) - GBA Video: Fix rare regression blending semitransparent sprites (fixes mgba.io/i/1876) - 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) Other fixes: - 3DS: Redo video sync to be more precise - 3DS: Fix crash with libctru 2.0 when exiting
M
src/gba/renderers/video-software.c
→
src/gba/renderers/video-software.c
@@ -643,17 +643,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; }