aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Zielinski <[email protected]>2019-07-23 12:47:28 +0200
committerJan Zielinski <[email protected]>2019-07-23 21:55:09 +0200
commit3d6cffffcf41349ff5db332a4662adb49d842a3a (patch)
tree2c13320c74bb17cb3e9711b4e9102c4be0bd4a60 /src
parentec4a5f5e1388155a45b083e5de3143a6ed635127 (diff)
swr/rasterizer: Fix 3D resource copies.
Ensure constant attributes stay constant with barycentric interpolation. Reviewed-by: Alok Hota <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/swr/rasterizer/common/simdintrin.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gallium/drivers/swr/rasterizer/common/simdintrin.h b/src/gallium/drivers/swr/rasterizer/common/simdintrin.h
index 4145ba8dcce..df5c3ac6056 100644
--- a/src/gallium/drivers/swr/rasterizer/common/simdintrin.h
+++ b/src/gallium/drivers/swr/rasterizer/common/simdintrin.h
@@ -282,6 +282,13 @@ static SIMDINLINE simdscalar InterpolateComponent(simdscalar const& vI,
const float* pInterpB = &pInterpBuffer[Attrib * 3 * numComponents + numComponents + Comp];
const float* pInterpC = &pInterpBuffer[Attrib * 3 * numComponents + numComponents * 2 + Comp];
+ if ((pInterpA[0] == pInterpB[0]) && (pInterpA[0] == pInterpC[0]))
+ {
+ // Ensure constant attribs are constant. Required for proper
+ // 3D resource copies.
+ return _simd_broadcast_ss(pInterpA);
+ }
+
simdscalar vA = _simd_broadcast_ss(pInterpA);
simdscalar vB = _simd_broadcast_ss(pInterpB);
simdscalar vC = _simd_broadcast_ss(pInterpC);
@@ -332,6 +339,13 @@ static SIMDINLINE simd4scalar InterpolateComponent(simd4scalar const& vI,
const float* pInterpB = &pInterpBuffer[Attrib * 3 * numComponents + numComponents + Comp];
const float* pInterpC = &pInterpBuffer[Attrib * 3 * numComponents + numComponents * 2 + Comp];
+ if ((pInterpA[0] == pInterpB[0]) && (pInterpA[0] == pInterpC[0]))
+ {
+ // Ensure constant attribs are constant. Required for proper
+ // 3D resource copies.
+ return SIMD128::broadcast_ss(pInterpA);
+ }
+
simd4scalar vA = SIMD128::broadcast_ss(pInterpA);
simd4scalar vB = SIMD128::broadcast_ss(pInterpB);
simd4scalar vC = SIMD128::broadcast_ss(pInterpC);