diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp index 1871caeb..1166b770 100644 --- a/src/GPU3D_Soft.cpp +++ b/src/GPU3D_Soft.cpp @@ -741,8 +741,8 @@ void SoftRenderer::RenderShadowMaskScanline(RendererPolygon* rp, s32 y) interp_start = &rp->SlopeR.Interp; interp_end = &rp->SlopeL.Interp; - rp->SlopeR.EdgeParams(&l_edgelen, &l_edgecov); - rp->SlopeL.EdgeParams(&r_edgelen, &r_edgecov); + rp->SlopeR.EdgeParams(&l_edgelen, &l_edgecov, true); + rp->SlopeL.EdgeParams(&r_edgelen, &r_edgecov, true); std::swap(xstart, xend); std::swap(wl, wr); @@ -773,9 +773,9 @@ void SoftRenderer::RenderShadowMaskScanline(RendererPolygon* rp, s32 y) interp_start = &rp->SlopeL.Interp; interp_end = &rp->SlopeR.Interp; - rp->SlopeL.EdgeParams(&l_edgelen, &l_edgecov); - rp->SlopeR.EdgeParams(&r_edgelen, &r_edgecov); - + rp->SlopeL.EdgeParams(&l_edgelen, &l_edgecov, false); + rp->SlopeR.EdgeParams(&r_edgelen, &r_edgecov, false); + // CHECKME: edge fill rules for unswapped opaque shadow mask polygons if ((GPU.GPU3D.RenderDispCnt & ((1<<4)|(1<<5))) || ((polyalpha < 31) && (GPU.GPU3D.RenderDispCnt & (1<<3))) || wireframe) { @@ -970,8 +970,8 @@ void SoftRenderer::RenderPolygonScanline(RendererPolygon* rp, s32 y) interp_start = &rp->SlopeR.Interp; interp_end = &rp->SlopeL.Interp; - rp->SlopeR.EdgeParams(&l_edgelen, &l_edgecov); - rp->SlopeL.EdgeParams(&r_edgelen, &r_edgecov); + rp->SlopeR.EdgeParams(&l_edgelen, &l_edgecov, true); + rp->SlopeL.EdgeParams(&r_edgelen, &r_edgecov, true); std::swap(xstart, xend); std::swap(wl, wr); @@ -1008,8 +1008,8 @@ void SoftRenderer::RenderPolygonScanline(RendererPolygon* rp, s32 y) interp_start = &rp->SlopeL.Interp; interp_end = &rp->SlopeR.Interp; - rp->SlopeL.EdgeParams(&l_edgelen, &l_edgecov); - rp->SlopeR.EdgeParams(&r_edgelen, &r_edgecov); + rp->SlopeL.EdgeParams(&l_edgelen, &l_edgecov, false); + rp->SlopeR.EdgeParams(&r_edgelen, &r_edgecov, false); // edge fill rules for unswapped opaque edges: // * right edge is filled if slope > 1 diff --git a/src/GPU3D_Soft.h b/src/GPU3D_Soft.h index 38de794c..9b284932 100644 --- a/src/GPU3D_Soft.h +++ b/src/GPU3D_Soft.h @@ -347,13 +347,12 @@ private: else if (ret > xmax) ret = xmax; return ret; } - - template - constexpr void EdgeParams_XMajor(s32* length, s32* coverage) const + + constexpr void EdgeParams_XMajor(s32* length, s32* coverage, bool swapped) const { // only do length calc for right side when swapped as it's // only needed for aa calcs, as actual line spans are broken - if constexpr (!swapped || side) + if (!swapped || side) { if (side ^ Negative) *length = (dx >> 18) - ((dx-Increment) >> 18); @@ -379,11 +378,10 @@ private: *coverage = startcov; - if constexpr (swapped) *length = 1; + if (swapped) *length = 1; } - template - constexpr void EdgeParams_YMajor(s32* length, s32* coverage) const + constexpr void EdgeParams_YMajor(s32* length, s32* coverage, bool swapped) const { *length = 1; @@ -404,14 +402,13 @@ private: *coverage = cov << 5; } } - - template - constexpr void EdgeParams(s32* length, s32* coverage) const + + constexpr void EdgeParams(s32* length, s32* coverage, bool swapped) const { if (XMajor) - return EdgeParams_XMajor(length, coverage); + return EdgeParams_XMajor(length, coverage, swapped); else - return EdgeParams_YMajor(length, coverage); + return EdgeParams_YMajor(length, coverage, swapped); } s32 Increment;