all repos — mgba @ 80ff9596b98944a5626fd6819b8eda861013c38c

mGBA Game Boy Advance Emulator

DS GX: Fix texture clipping issues
Vicki Pfau vi@endrift.com
Wed, 01 Mar 2017 23:13:00 -0800
commit

80ff9596b98944a5626fd6819b8eda861013c38c

parent

0c6061965146725057e163029ca330777257dae4

2 files changed, 5 insertions(+), 5 deletions(-)

jump to
M include/mgba/internal/ds/gx/software.hinclude/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.csrc/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)) {