From 4bd94a4e5e75ac890c9dcb94e8a917cd62c27d0e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 29 Dec 2021 07:11:53 -0800 Subject: [PATCH] samplerjit: Pass funcs as an argument. Seeing computing the ID in some profiles, so want to avoid computing per thread/invocation. --- GPU/Software/Rasterizer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GPU/Software/Rasterizer.cpp b/GPU/Software/Rasterizer.cpp index 156dace489..a79aef3274 100644 --- a/GPU/Software/Rasterizer.cpp +++ b/GPU/Software/Rasterizer.cpp @@ -711,7 +711,8 @@ void DrawTriangleSlice( int x1, int y1, int x2, int y2, bool byY, int h1, int h2, const PixelFuncID &pixelID, - const Rasterizer::SingleFunc &drawPixel) + const Rasterizer::SingleFunc &drawPixel, + const Sampler::Funcs &sampler) { Vec4 bias0 = Vec4::AssignToAll(IsRightSideOrFlatBottomLine(v0.screenpos.xy(), v1.screenpos.xy(), v2.screenpos.xy()) ? -1 : 0); Vec4 bias1 = Vec4::AssignToAll(IsRightSideOrFlatBottomLine(v1.screenpos.xy(), v2.screenpos.xy(), v0.screenpos.xy()) ? -1 : 0); @@ -756,8 +757,6 @@ void DrawTriangleSlice( // This is common, and when we interpolate, we lose accuracy. const bool flatZ = v0.screenpos.z == v1.screenpos.z && v0.screenpos.z == v2.screenpos.z; - Sampler::Funcs sampler = Sampler::GetFuncs(); - for (int64_t curY = minY; curY <= maxY; curY += 32, w0_base = e0.StepY(w0_base), w1_base = e1.StepY(w1_base), @@ -894,6 +893,7 @@ void DrawTriangle(const VertexData& v0, const VertexData& v1, const VertexData& PixelFuncID pixelID; ComputePixelFuncID(&pixelID); Rasterizer::SingleFunc drawPixel = Rasterizer::GetSingleFunc(pixelID); + Sampler::Funcs sampler = Sampler::GetFuncs(); const bool hasMipLevels = gstate.isMipmapEnabled() ? gstate.getTextureMaxLevel() > 0 : false; auto drawSlice = (hasMipLevels ? @@ -905,16 +905,16 @@ void DrawTriangle(const VertexData& v0, const VertexData& v1, const VertexData& if (rangeY >= 12 && rangeX >= rangeY * 4) { auto bound = [&](int a, int b) -> void { - drawSlice(v0, v1, v2, minX, minY, maxX, maxY, false, a, b, pixelID, drawPixel); + drawSlice(v0, v1, v2, minX, minY, maxX, maxY, false, a, b, pixelID, drawPixel, sampler); }; ParallelRangeLoop(&g_threadManager, bound, 0, rangeX, MIN_LINES_PER_THREAD); } else if (rangeY >= 12 && rangeX >= 12) { auto bound = [&](int a, int b) -> void { - drawSlice(v0, v1, v2, minX, minY, maxX, maxY, true, a, b, pixelID, drawPixel); + drawSlice(v0, v1, v2, minX, minY, maxX, maxY, true, a, b, pixelID, drawPixel, sampler); }; ParallelRangeLoop(&g_threadManager, bound, 0, rangeY, MIN_LINES_PER_THREAD); } else { - drawSlice(v0, v1, v2, minX, minY, maxX, maxY, true, 0, rangeY, pixelID, drawPixel); + drawSlice(v0, v1, v2, minX, minY, maxX, maxY, true, 0, rangeY, pixelID, drawPixel, sampler); } }