mirror of https://github.com/mgba-emu/mgba.git
DS GX: Remove per-scanline divides
This commit is contained in:
parent
8792ea1354
commit
ab663a24a8
|
@ -36,6 +36,7 @@ struct DSGXSoftwareEdge {
|
||||||
int32_t x0; // 20.12
|
int32_t x0; // 20.12
|
||||||
int32_t z0; // 20.12
|
int32_t z0; // 20.12
|
||||||
int32_t w0; // 20.12
|
int32_t w0; // 20.12
|
||||||
|
int64_t wr0;
|
||||||
uint8_t cr0;
|
uint8_t cr0;
|
||||||
uint8_t cg0;
|
uint8_t cg0;
|
||||||
uint8_t cb0;
|
uint8_t cb0;
|
||||||
|
@ -46,6 +47,7 @@ struct DSGXSoftwareEdge {
|
||||||
int32_t x1; // 20.12
|
int32_t x1; // 20.12
|
||||||
int32_t z1; // 20.12
|
int32_t z1; // 20.12
|
||||||
int32_t w1; // 20.12
|
int32_t w1; // 20.12
|
||||||
|
int64_t wr1;
|
||||||
uint8_t cr1;
|
uint8_t cr1;
|
||||||
uint8_t cg1;
|
uint8_t cg1;
|
||||||
uint8_t cb1;
|
uint8_t cb1;
|
||||||
|
|
|
@ -313,8 +313,8 @@ static bool _edgeToSpan(struct DSGXSoftwareSpan* span, const struct DSGXSoftware
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t w0 = 0x7FFFFFFFFFFFFFFF / edge->w0;
|
int64_t w0 = edge->wr0;
|
||||||
int64_t w1 = 0x7FFFFFFFFFFFFFFF / edge->w1;
|
int64_t w1 = edge->wr1;
|
||||||
int64_t w = w1 - w0;
|
int64_t w = w1 - w0;
|
||||||
|
|
||||||
// Losslessly interpolate two 64-bit values
|
// Losslessly interpolate two 64-bit values
|
||||||
|
@ -526,6 +526,8 @@ static void _preparePoly(struct DSGXRenderer* renderer, struct DSGXVertex* verts
|
||||||
edge->s1 = v0->vs;
|
edge->s1 = v0->vs;
|
||||||
edge->t1 = v0->vt;
|
edge->t1 = v0->vt;
|
||||||
}
|
}
|
||||||
|
edge->wr0 = 0x7FFFFFFFFFFFFFFF / edge->w0;
|
||||||
|
edge->wr1 = 0x7FFFFFFFFFFFFFFF / edge->w1;
|
||||||
|
|
||||||
edge = DSGXSoftwareEdgeListAppend(&softwareRenderer->activeEdges);
|
edge = DSGXSoftwareEdgeListAppend(&softwareRenderer->activeEdges);
|
||||||
edge->polyId = poly->polyId;
|
edge->polyId = poly->polyId;
|
||||||
|
@ -578,6 +580,8 @@ static void _preparePoly(struct DSGXRenderer* renderer, struct DSGXVertex* verts
|
||||||
edge->s1 = v0->vs;
|
edge->s1 = v0->vs;
|
||||||
edge->t1 = v0->vt;
|
edge->t1 = v0->vt;
|
||||||
}
|
}
|
||||||
|
edge->wr0 = 0x7FFFFFFFFFFFFFFF / edge->w0;
|
||||||
|
edge->wr1 = 0x7FFFFFFFFFFFFFFF / edge->w1;
|
||||||
|
|
||||||
if (poly->maxY >= DS_VIDEO_VERTICAL_PIXELS) {
|
if (poly->maxY >= DS_VIDEO_VERTICAL_PIXELS) {
|
||||||
poly->maxY = DS_VIDEO_VERTICAL_PIXELS - 1;
|
poly->maxY = DS_VIDEO_VERTICAL_PIXELS - 1;
|
||||||
|
|
Loading…
Reference in New Issue