aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeorge Kyriazis <[email protected]>2018-02-01 19:28:58 -0600
committerGeorge Kyriazis <[email protected]>2018-02-16 10:54:00 -0600
commit8a64593bde93fc3e88bb712c12ebe90837b54d5a (patch)
tree490da976197608c36c8784e3f74f4b3cc9c312bb /src
parent3e560b7c851d6b663bfdad4e10f1363404c80ad9 (diff)
swr/rast: More precise user clip distance interpolation
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/backend_impl.h4
-rw-r--r--src/gallium/drivers/swr/rasterizer/core/binner.cpp17
2 files changed, 4 insertions, 17 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_impl.h b/src/gallium/drivers/swr/rasterizer/core/backend_impl.h
index 2cfd52e829d..454f473b47e 100644
--- a/src/gallium/drivers/swr/rasterizer/core/backend_impl.h
+++ b/src/gallium/drivers/swr/rasterizer/core/backend_impl.h
@@ -62,8 +62,10 @@ static INLINE simdmask ComputeUserClipMask(uint8_t clipMask, float* pUserClipBuf
simdscalar vB = _simd_broadcast_ss(pUserClipBuffer++);
simdscalar vC = _simd_broadcast_ss(pUserClipBuffer++);
+ simdscalar vK = _simd_sub_ps(_simd_sub_ps(_simd_set1_ps(1.0f), vI), vJ);
+
// interpolate
- simdscalar vInterp = vplaneps(vA, vB, vC, vI, vJ);
+ simdscalar vInterp = vplaneps(vA, vB, _simd_mul_ps(vK, vC), vI, vJ);
// clip if interpolated clip distance is < 0 || NAN
simdscalar vCull = _simd_cmp_ps(_simd_setzero_ps(), vInterp, _CMP_NLE_UQ);
diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
index 4510b13969c..8447bc4dc29 100644
--- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
@@ -256,27 +256,12 @@ void ProcessUserClipDist(const SWR_BACKEND_STATE& state, PA_STATE& pa, uint32_t
simd4scalar primClipDist[3];
pa.AssembleSingle(clipAttribSlot, primIndex, primClipDist);
- float vertClipDist[NumVerts];
for (uint32_t e = 0; e < NumVerts; ++e)
{
OSALIGNSIMD(float) aVertClipDist[4];
SIMD128::store_ps(aVertClipDist, primClipDist[e]);
- vertClipDist[e] = aVertClipDist[clipComp];
+ *(pUserClipBuffer++) = aVertClipDist[clipComp];
};
-
- // setup plane equations for barycentric interpolation in the backend
- float baryCoeff[NumVerts];
- float last = vertClipDist[NumVerts - 1] * pRecipW[NumVerts - 1];
- for (uint32_t e = 0; e < NumVerts - 1; ++e)
- {
- baryCoeff[e] = vertClipDist[e] * pRecipW[e] - last;
- }
- baryCoeff[NumVerts - 1] = last;
-
- for (uint32_t e = 0; e < NumVerts; ++e)
- {
- *(pUserClipBuffer++) = baryCoeff[e];
- }
}
}