remove templates

seems to just make things sliiightly slower on my machine
This commit is contained in:
Jaklyy 2023-12-10 15:40:58 -05:00
parent 0c8095c1bb
commit 3facbe90c9
2 changed files with 18 additions and 21 deletions

View File

@ -741,8 +741,8 @@ void SoftRenderer::RenderShadowMaskScanline(RendererPolygon* rp, s32 y)
interp_start = &rp->SlopeR.Interp;
interp_end = &rp->SlopeL.Interp;
rp->SlopeR.EdgeParams<true>(&l_edgelen, &l_edgecov);
rp->SlopeL.EdgeParams<true>(&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,8 +773,8 @@ void SoftRenderer::RenderShadowMaskScanline(RendererPolygon* rp, s32 y)
interp_start = &rp->SlopeL.Interp;
interp_end = &rp->SlopeR.Interp;
rp->SlopeL.EdgeParams<false>(&l_edgelen, &l_edgecov);
rp->SlopeR.EdgeParams<false>(&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<true>(&l_edgelen, &l_edgecov);
rp->SlopeL.EdgeParams<true>(&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<false>(&l_edgelen, &l_edgecov);
rp->SlopeR.EdgeParams<false>(&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

View File

@ -348,12 +348,11 @@ private:
return ret;
}
template<bool swapped>
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<bool swapped>
constexpr void EdgeParams_YMajor(s32* length, s32* coverage) const
constexpr void EdgeParams_YMajor(s32* length, s32* coverage, bool swapped) const
{
*length = 1;
@ -405,13 +403,12 @@ private:
}
}
template<bool swapped>
constexpr void EdgeParams(s32* length, s32* coverage) const
constexpr void EdgeParams(s32* length, s32* coverage, bool swapped) const
{
if (XMajor)
return EdgeParams_XMajor<swapped>(length, coverage);
return EdgeParams_XMajor(length, coverage, swapped);
else
return EdgeParams_YMajor<swapped>(length, coverage);
return EdgeParams_YMajor(length, coverage, swapped);
}
s32 Increment;