From 77d0a0d76e28df3d2393d62ff98ce3cec4431f33 Mon Sep 17 00:00:00 2001 From: StapleButter Date: Thu, 1 Jun 2017 15:16:44 +0200 Subject: only do lower-pixel rendering when rendering under an edge --- src/GPU3D_Soft.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/GPU3D_Soft.cpp') diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp index 07222f2..e78524d 100644 --- a/src/GPU3D_Soft.cpp +++ b/src/GPU3D_Soft.cpp @@ -1027,10 +1027,14 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) continue; } + u32 dstattr = AttrBuffer[pixeladdr]; + // if depth test against the topmost pixel fails, test // against the pixel underneath if (!fnDepthTest(DepthBuffer[pixeladdr], z)) { + if (!(dstattr & 0x3)) continue; + pixeladdr += 258; if (!fnDepthTest(DepthBuffer[pixeladdr], z)) continue; @@ -1096,7 +1100,6 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) } else { - u32 dstattr = AttrBuffer[pixeladdr]; attr |= (1<<30); if (polygon->IsShadow) dstattr |= (1<<30); @@ -1148,10 +1151,14 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) continue; } + u32 dstattr = AttrBuffer[pixeladdr]; + // if depth test against the topmost pixel fails, test // against the pixel underneath if (!fnDepthTest(DepthBuffer[pixeladdr], z)) { + if (!(dstattr & 0x3)) continue; + pixeladdr += 258; if (!fnDepthTest(DepthBuffer[pixeladdr], z)) continue; @@ -1244,10 +1251,14 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) continue; } + u32 dstattr = AttrBuffer[pixeladdr]; + // if depth test against the topmost pixel fails, test // against the pixel underneath if (!fnDepthTest(DepthBuffer[pixeladdr], z)) { + if (!(dstattr & 0x3)) continue; + pixeladdr += 258; if (!fnDepthTest(DepthBuffer[pixeladdr], z)) continue; @@ -1313,7 +1324,6 @@ void RenderPolygonScanline(RendererPolygon* rp, s32 y) } else { - u32 dstattr = AttrBuffer[pixeladdr]; attr |= (1<<30); if (polygon->IsShadow) dstattr |= (1<<30); -- cgit v1.2.3