From 98ddefbd5a8f52f56041266313eff1cf51c82653 Mon Sep 17 00:00:00 2001 From: xebra Date: Sat, 21 Jul 2018 23:00:28 +0900 Subject: [PATCH] [spline/bezier]Extract an if-check in the hot loops to the template parameter. --- GPU/Common/SplineCommon.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/GPU/Common/SplineCommon.cpp b/GPU/Common/SplineCommon.cpp index 6fb31015bb..e3718dad38 100644 --- a/GPU/Common/SplineCommon.cpp +++ b/GPU/Common/SplineCommon.cpp @@ -340,7 +340,7 @@ public: defcolor = points[0]->color_32; } - template + template void Tessellate(SimpleVertex *vertices, u16 *indices, int &count) { const float inv_u = 1.0f / (float)patch.tess_u; const float inv_v = 1.0f / (float)patch.tess_v; @@ -396,7 +396,7 @@ public: const Vec3f derivV = tess_pos.SampleV(wv.deriv); vert.nrm = Cross(derivU, derivV).Normalized(useSSE4); - if (patch.patchFacing) + if (patchFacing) vert.nrm *= -1.0f; } else { vert.nrm.SetZero(); @@ -414,7 +414,7 @@ public: void Tessellate(SimpleVertex *vertices, u16 *indices, int &count, u32 origVertType) { using TessFunc = void(SubdivisionSurface::*)(SimpleVertex *, u16 *, int &); - constexpr int NumParams = 4; + constexpr int NumParams = 5; static TemplateParameterDispatcherTess dispatcher; // Initialize only once const bool params[NumParams] = { @@ -422,6 +422,7 @@ public: (origVertType & GE_VTYPE_COL_MASK) != 0, (origVertType & GE_VTYPE_TC_MASK) != 0, cpu_info.bSSE4_1, + patch.patchFacing, }; TessFunc func = dispatcher.GetFunc(params); (this->*func)(vertices, indices, count);