From 3074a2b4facf5c51e82f3b9511089386193f988a Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Tue, 17 May 2016 16:32:08 -0600 Subject: swr: [rasterizer core] move centroid setup out of CalcCentroidBarycentrics Reviewed-by: Bruce Cherniak --- .../drivers/swr/rasterizer/core/backend.cpp | 22 ++++++++++++++++++++-- src/gallium/drivers/swr/rasterizer/core/backend.h | 13 ------------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.cpp b/src/gallium/drivers/swr/rasterizer/core/backend.cpp index 376fb3f..8e1fa78 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/backend.cpp @@ -703,7 +703,16 @@ void BackendSampleRate(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t x, uint32_ { ///@ todo: don't need to genererate input coverage 2x if input coverage and centroid RDTSC_START(BEBarycentric); - CalcCentroidBarycentrics(coeffs, psContext, &work.coverageMask[0], pBlendState->sampleMask, psContext.vX.UL, psContext.vY.UL); + if(T::bIsStandardPattern) + { + CalcCentroidPos(psContext, &work.coverageMask[0], pBlendState->sampleMask, psContext.vX.UL, psContext.vY.UL); + } + else + { + psContext.vX.centroid = _simd_add_ps(psContext.vX.UL, _simd_set1_ps(0.5f)); + psContext.vY.centroid = _simd_add_ps(psContext.vY.UL, _simd_set1_ps(0.5f)); + } + CalcCentroidBarycentrics(coeffs, psContext, psContext.vX.UL, psContext.vY.UL); RDTSC_STOP(BEBarycentric, 0, 0); } @@ -907,7 +916,16 @@ void BackendPixelRate(DRAW_CONTEXT *pDC, uint32_t workerId, uint32_t x, uint32_t { ///@ todo: don't need to genererate input coverage 2x if input coverage and centroid RDTSC_START(BEBarycentric); - CalcCentroidBarycentrics(coeffs, psContext, &work.coverageMask[0], pBlendState->sampleMask, psContext.vX.UL, psContext.vY.UL); + if(T::bIsStandardPattern) + { + CalcCentroidPos(psContext, &work.coverageMask[0], pBlendState->sampleMask, psContext.vX.UL, psContext.vY.UL); + } + else + { + psContext.vX.centroid = _simd_add_ps(psContext.vX.UL, _simd_set1_ps(0.5f)); + psContext.vY.centroid = _simd_add_ps(psContext.vY.UL, _simd_set1_ps(0.5f)); + } + CalcCentroidBarycentrics(coeffs, psContext, psContext.vX.UL, psContext.vY.UL); RDTSC_STOP(BEBarycentric, 0, 0); } diff --git a/src/gallium/drivers/swr/rasterizer/core/backend.h b/src/gallium/drivers/swr/rasterizer/core/backend.h index 2c11041..81dbe53 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend.h +++ b/src/gallium/drivers/swr/rasterizer/core/backend.h @@ -368,22 +368,9 @@ INLINE void CalcCentroidPos(SWR_PS_CONTEXT &psContext, const uint64_t *const cov psContext.vY.centroid = _simd_blendv_ps(psContext.vY.centroid, vYSample, _simd_castsi_ps(vCase3a)); } -template INLINE void CalcCentroidBarycentrics(const BarycentricCoeffs& coeffs, SWR_PS_CONTEXT &psContext, - const uint64_t *const coverageMask, const uint32_t sampleMask, const simdscalar vXSamplePosUL, const simdscalar vYSamplePosUL) { - if(T::bIsStandardPattern) - { - ///@ todo: don't need to generate input coverage 2x if input coverage and centroid - CalcCentroidPos(psContext, coverageMask, sampleMask, vXSamplePosUL, vYSamplePosUL); - } - else - { - static const __m256 pixelCenter = _simd_set1_ps(0.5f); - psContext.vX.centroid = _simd_add_ps(vXSamplePosUL, pixelCenter); - psContext.vY.centroid = _simd_add_ps(vYSamplePosUL, pixelCenter); - } // evaluate I,J psContext.vI.centroid = vplaneps(coeffs.vIa, coeffs.vIb, coeffs.vIc, psContext.vX.centroid, psContext.vY.centroid); psContext.vJ.centroid = vplaneps(coeffs.vJa, coeffs.vJb, coeffs.vJc, psContext.vX.centroid, psContext.vY.centroid); -- cgit v1.1