DS GX: Fix texture clipping issues
Vicki Pfau vi@endrift.com
Wed, 01 Mar 2017 23:13:00 -0800
2 files changed,
5 insertions(+),
5 deletions(-)
M
include/mgba/internal/ds/gx/software.h
→
include/mgba/internal/ds/gx/software.h
@@ -20,8 +20,8 @@ struct DSGXPolygon* poly;
uint16_t* texBase; uint16_t* palBase; int texFormat; - unsigned texW; - unsigned texH; + int texW; + int texH; int32_t topY; int32_t bottomY; int32_t topZ;
M
src/ds/gx/software.c
→
src/ds/gx/software.c
@@ -43,8 +43,8 @@ static color_t _lookupColor(struct DSGXSoftwareEndpoint* ep, struct DSGXSoftwarePolygon* poly) {
// TODO: Optimize uint16_t texel; - uint16_t s = ep->s >> 4; - uint16_t t = ep->t >> 4; + int16_t s = ep->s >> 4; + int16_t t = ep->t >> 4; if (!DSGXTexParamsIsSRepeat(poly->poly->texParams)) { if (s < 0) { s = 0;@@ -62,7 +62,7 @@ }
if (!DSGXTexParamsIsTRepeat(poly->poly->texParams)) { if (t < 0) { t = 0; - } else if (s >= poly->texH) { + } else if (t >= poly->texH) { t = poly->texW - 1; } } else if (DSGXTexParamsIsTMirror(poly->poly->texParams)) {