DS GX: Fix alpha blending
Vicki Pfau vi@endrift.com
Sat, 18 Mar 2017 23:13:43 -0700
2 files changed,
7 insertions(+),
10 deletions(-)
M
include/mgba/internal/ds/gx.h
→
include/mgba/internal/ds/gx.h
@@ -52,6 +52,7 @@ DECL_BITS(DSGXPolygonAttrs, Lights, 0, 4);
DECL_BITS(DSGXPolygonAttrs, Mode, 4, 2); DECL_BIT(DSGXPolygonAttrs, FrontFace, 6); DECL_BIT(DSGXPolygonAttrs, BackFace, 7); +DECL_BIT(DSGXPolygonAttrs, UpdateDepth, 11); // TODO DECL_BITS(DSGXPolygonAttrs, Alpha, 16, 5);
M
src/ds/gx/software.c
→
src/ds/gx/software.c
@@ -631,15 +631,11 @@ if (softwareRenderer->wSort) {
if (span->ep[0].w < softwareRenderer->depthBuffer[x]) { softwareRenderer->depthBuffer[x] = span->ep[0].w; scanline[x] = color; - } else if (b < 0x1F) { - scanline[x] = _mix32(b, current, 0x1F - b, color) | a << 27; } } else { if (span->ep[0].z < softwareRenderer->depthBuffer[x]) { softwareRenderer->depthBuffer[x] = span->ep[0].z; scanline[x] = color; - } else if (b < 0x1F) { - scanline[x] = _mix32(b, current, 0x1F - b, color) | a << 27; } } } else if (a) {@@ -650,17 +646,17 @@ color |= ab << 27;
} if (softwareRenderer->wSort) { if (span->ep[0].w < softwareRenderer->depthBuffer[x]) { - softwareRenderer->depthBuffer[x] = span->ep[0].w; + if (DSGXPolygonAttrsIsUpdateDepth(span->poly->poly->polyParams)) { + softwareRenderer->depthBuffer[x] = span->ep[0].w; + } scanline[x] = color; - } else if (b < 0x1F) { - scanline[x] = _mix32(b, current, 0x1F - b, color) | ab << 27; } } else { if (span->ep[0].z < softwareRenderer->depthBuffer[x]) { - softwareRenderer->depthBuffer[x] = span->ep[0].z; + if (DSGXPolygonAttrsIsUpdateDepth(span->poly->poly->polyParams)) { + softwareRenderer->depthBuffer[x] = span->ep[0].z; + } scanline[x] = color; - } else if (b < 0x1F) { - scanline[x] = _mix32(b, current, 0x1F - b, color) | ab << 27; } } }