From d1781c8bf2a0bd65c72e7349834a20932467252d Mon Sep 17 00:00:00 2001 From: StapleButter Date: Thu, 1 Jun 2017 14:59:41 +0200 Subject: remove more per-pixel checks --- src/GPU3D_Soft.cpp | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp index 23441b1..07222f2 100644 --- a/src/GPU3D_Soft.cpp +++ b/src/GPU3D_Soft.cpp @@ -986,13 +986,12 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) s32 x = xstart; Interpolator interpX(xstart, xend+1, wl, wr, 8); + if (x < 0) x = 0; + // part 1: left edge edge = yedge | 0x1; for (; x < xstart+l_edgelen; x++) { - if (x < 0) continue; - if (x > 255) break; - u32 pixeladdr = 258*3 + 1 + (y*258*3) + x; u32 attr = (polygon->Attr & 0x3F008000) | edge; @@ -1102,11 +1101,6 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) if (polygon->IsShadow) dstattr |= (1<<30); // skip if polygon IDs are equal - // note: this only happens if the destination pixel was translucent - // or always when drawing a shadow - // (the GPU keeps track of which pixels are translucent, regardless of - // the destination alpha) - // TODO: they say that there are two separate polygon ID buffers. verify that. if ((dstattr & 0x7F000000) == (attr & 0x7F000000)) continue; @@ -1129,9 +1123,6 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) if (wireframe && !edge) x = xend-r_edgelen+1; else for (; x <= xend-r_edgelen; x++) { - if (x < 0) continue; - if (x > 255) break; - u32 pixeladdr = 258*3 + 1 + (y*258*3) + x; u32 attr = (polygon->Attr & 0x3F008000) | edge; @@ -1212,13 +1203,12 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) AttrBuffer[pixeladdr] = attr; } + if (xend > 255) xend = 255; + // part 3: right edge edge = yedge | 0x2; for (; x <= xend; x++) { - if (x < 0) continue; - if (x > 255) break; - u32 pixeladdr = 258*3 + 1 + (y*258*3) + x; u32 attr = (polygon->Attr & 0x3F008000) | edge; @@ -1328,11 +1318,6 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) if (polygon->IsShadow) dstattr |= (1<<30); // skip if polygon IDs are equal - // note: this only happens if the destination pixel was translucent - // or always when drawing a shadow - // (the GPU keeps track of which pixels are translucent, regardless of - // the destination alpha) - // TODO: they say that there are two separate polygon ID buffers. verify that. if ((dstattr & 0x7F000000) == (attr & 0x7F000000)) continue; -- cgit v1.2.3