DS GX: Remove per-scanline divides
Vicki Pfau vi@endrift.com
Tue, 21 Mar 2017 21:58:14 -0700
2 files changed,
8 insertions(+),
2 deletions(-)
M
include/mgba/internal/ds/gx/software.h
→
include/mgba/internal/ds/gx/software.h
@@ -36,6 +36,7 @@ int32_t y0; // 20.12
int32_t x0; // 20.12 int32_t z0; // 20.12 int32_t w0; // 20.12 + int64_t wr0; uint8_t cr0; uint8_t cg0; uint8_t cb0;@@ -46,6 +47,7 @@ int32_t y1; // 20.12
int32_t x1; // 20.12 int32_t z1; // 20.12 int32_t w1; // 20.12 + int64_t wr1; uint8_t cr1; uint8_t cg1; uint8_t cb1;
M
src/ds/gx/software.c
→
src/ds/gx/software.c
@@ -313,8 +313,8 @@ index = 0;
} } - int64_t w0 = 0x7FFFFFFFFFFFFFFF / edge->w0; - int64_t w1 = 0x7FFFFFFFFFFFFFFF / edge->w1; + int64_t w0 = edge->wr0; + int64_t w1 = edge->wr1; int64_t w = w1 - w0; // Losslessly interpolate two 64-bit values@@ -526,6 +526,8 @@ _expandColor(v0->color, &edge->cr1, &edge->cg1, &edge->cb1);
edge->s1 = v0->vs; edge->t1 = v0->vt; } + edge->wr0 = 0x7FFFFFFFFFFFFFFF / edge->w0; + edge->wr1 = 0x7FFFFFFFFFFFFFFF / edge->w1; edge = DSGXSoftwareEdgeListAppend(&softwareRenderer->activeEdges); edge->polyId = poly->polyId;@@ -578,6 +580,8 @@ _expandColor(v0->color, &edge->cr1, &edge->cg1, &edge->cb1);
edge->s1 = v0->vs; edge->t1 = v0->vt; } + edge->wr0 = 0x7FFFFFFFFFFFFFFF / edge->w0; + edge->wr1 = 0x7FFFFFFFFFFFFFFF / edge->w1; if (poly->maxY >= DS_VIDEO_VERTICAL_PIXELS) { poly->maxY = DS_VIDEO_VERTICAL_PIXELS - 1;