all repos — mgba @ 76b8916dfec91edd2966be7ebbb6742e92123d2a

mGBA Game Boy Advance Emulator

DS Video: Possibly fix 2D/3D blending alpha values, I really need to make tests
Vicki Pfau vi@endrift.com
Mon, 17 Jul 2017 16:56:25 -0700
commit

76b8916dfec91edd2966be7ebbb6742e92123d2a

parent

e472ca5b6cd12de594c3d785240aa48b0b201c3f

1 files changed, 4 insertions(+), 7 deletions(-)

jump to
M src/ds/renderers/software.csrc/ds/renderers/software.c

@@ -407,9 +407,7 @@ if (TEST_LAYER_ENABLED(0)) {

if (DSRegisterDISPCNTIs3D(softwareRenderer->dispcnt) && gx) { const color_t* scanline; gx->renderer->getScanline(gx->renderer, y, &scanline); - uint32_t flags = (softwareRenderer->bg[0].priority << OFFSET_PRIORITY) | FLAG_IS_BACKGROUND; - flags |= FLAG_TARGET_2 * softwareRenderer->bg[0].target2; - flags |= FLAG_TARGET_1 * (softwareRenderer->bg[0].target1 && softwareRenderer->blendEffect == BLEND_ALPHA && GBAWindowControlIsBlendEnable(softwareRenderer->currentWindow.packed)); + uint32_t flags = (softwareRenderer->bg[0].priority << OFFSET_PRIORITY) | FLAG_IS_BACKGROUND | FLAG_TARGET_1 | FLAG_TARGET_2; int x; for (x = softwareRenderer->start; x < softwareRenderer->end; ++x) { color_t color = scanline[x];

@@ -425,12 +423,11 @@ if ((scanline[x] >> 28) != 0xF) {

// TODO: More precise values softwareRenderer->alphaA[x] = (color >> 28) + 1; softwareRenderer->alphaB[x] = 0xF - (color >> 28); - _compositeBlendNoObjwin(softwareRenderer, x, (color & 0x00FFFFFF) | flags | FLAG_TARGET_1, softwareRenderer->row[x]); + _compositeBlendNoObjwin(softwareRenderer, x, (color & 0x00FFFFFF) | flags, softwareRenderer->row[x]); } else { - if (!(flags & FLAG_TARGET_2) || !(softwareRenderer->row[x] & FLAG_TARGET_1)) { + if (!(softwareRenderer->row[x] & FLAG_TARGET_1)) { _compositeNoBlendNoObjwin(softwareRenderer, x, (color & 0x00FFFFFF) | flags, softwareRenderer->row[x]); - } else if (softwareRenderer->row[x] & FLAG_TARGET_1) { - softwareRenderer->alphaB[x] = 0x10; + } else { _compositeBlendNoObjwin(softwareRenderer, x, (color & 0x00FFFFFF) | flags, softwareRenderer->row[x]); } softwareRenderer->alphaA[x] = 0x10;