all repos — mgba @ 432f079f3a03be16b58780ddebcbd2bd069ab90e

mGBA Game Boy Advance Emulator

DS GX: Fix degenerate spans
Vicki Pfau vi@endrift.com
Tue, 28 Feb 2017 19:28:05 -0800
commit

432f079f3a03be16b58780ddebcbd2bd069ab90e

parent

eabcb59514254820a5ff61ed522e20e637f532f9

1 files changed, 6 insertions(+), 2 deletions(-)

jump to
M src/ds/gx/software.csrc/ds/gx/software.c

@@ -264,11 +264,12 @@ }

unsigned poly = edge->polyId; struct DSGXSoftwareSpan* span = softwareRenderer->bucket[poly]; - if (span) { + if (span && !span->ep[1].w) { _edgeToSpan(span, edge, 1, y); softwareRenderer->bucket[poly] = NULL; - } else { + } else if (!span) { span = DSGXSoftwareSpanListAppend(&softwareRenderer->activeSpans); + memset(span, 0, sizeof(*span)); if (!_edgeToSpan(span, edge, 0, y)) { // Horizontal line DSGXSoftwareSpanListShift(&softwareRenderer->activeSpans, DSGXSoftwareSpanListSize(&softwareRenderer->activeSpans) - 1, 1);

@@ -302,6 +303,9 @@ break;

} span = DSGXSoftwareSpanListGetPointer(&softwareRenderer->activeSpans, nextSpanId - 1); nextSpanX = span->ep[0].x >> 12; + } + if (i < nextSpanX) { + span = NULL; } } if (span) {