From 7046695a0e8f86ee612abfadfba4506bbb991cab Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Tue, 14 Mar 2017 19:37:30 -0500 Subject: [PATCH] swr: [rasterizer core] Fix trifan regression from 9d3442575f Fixes piglit triangle-rasterization-overdraw. SIMD16 path not working. Reviewed-by: Bruce Cherniak --- src/gallium/drivers/swr/rasterizer/core/pa.h | 2 ++ src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/core/pa.h b/src/gallium/drivers/swr/rasterizer/core/pa.h index 6160996cad3..781c0946143 100644 --- a/src/gallium/drivers/swr/rasterizer/core/pa.h +++ b/src/gallium/drivers/swr/rasterizer/core/pa.h @@ -119,6 +119,8 @@ struct PA_STATE // cuts struct PA_STATE_OPT : public PA_STATE { + SIMDVERTEX leadingVertex; // For tri-fan + uint32_t numPrims{ 0 }; // Total number of primitives for draw. uint32_t numPrimsComplete{ 0 }; // Total number of complete primitives. diff --git a/src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp b/src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp index 2a4104aacd3..297f23a88ca 100644 --- a/src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/pa_avx.cpp @@ -1213,6 +1213,10 @@ void PaTriStripSingle0(PA_STATE_OPT& pa, uint32_t slot, uint32_t primIndex, __m1 bool PaTriFan0(PA_STATE_OPT& pa, uint32_t slot, simdvector verts[]) { + // store off leading vertex for attributes + PA_STATE_OPT::SIMDVERTEX* pVertex = (PA_STATE_OPT::SIMDVERTEX*)pa.pStreamBase; + pa.leadingVertex = pVertex[pa.cur]; + SetNextPaState(pa, PaTriFan1, PaTriFanSingle0); return false; // Not enough vertices to assemble 8 triangles. } @@ -1224,7 +1228,7 @@ bool PaTriFan1(PA_STATE_OPT& pa, uint32_t slot, simdvector verts[]) simdvector a; simdvector b; - const simd16vector &leadvert_16 = PaGetSimdVector_simd16(pa, pa.first, slot); + const simd16vector &leadvert_16 = pa.leadingVertex.attrib[slot]; if (!pa.useAlternateOffset) { @@ -1252,7 +1256,7 @@ bool PaTriFan1(PA_STATE_OPT& pa, uint32_t slot, simdvector verts[]) } #else - simdvector &leadVert = PaGetSimdVector(pa, pa.first, slot); + simdvector &leadVert = pa.leadingVertex.attrib[slot]; simdvector &a = PaGetSimdVector(pa, pa.prev, slot); simdvector &b = PaGetSimdVector(pa, pa.cur, slot); @@ -1293,7 +1297,7 @@ bool PaTriFan0_simd16(PA_STATE_OPT& pa, uint32_t slot, simd16vector verts[]) bool PaTriFan1_simd16(PA_STATE_OPT& pa, uint32_t slot, simd16vector verts[]) { - const simd16vector &a = PaGetSimdVector_simd16(pa, pa.first, slot); + const simd16vector &a = pa.leadingVertex.attrib[slot]; const simd16vector &b = PaGetSimdVector_simd16(pa, pa.prev, slot); const simd16vector &c = PaGetSimdVector_simd16(pa, pa.cur, slot); @@ -1329,7 +1333,7 @@ bool PaTriFan1_simd16(PA_STATE_OPT& pa, uint32_t slot, simd16vector verts[]) void PaTriFanSingle0(PA_STATE_OPT& pa, uint32_t slot, uint32_t primIndex, __m128 verts[]) { #if USE_SIMD16_FRONTEND - const simd16vector &a = PaGetSimdVector_simd16(pa, pa.first, slot); + const simd16vector &a = pa.leadingVertex.attrib[slot]; const simd16vector &b = PaGetSimdVector_simd16(pa, pa.prev, slot); const simd16vector &c = PaGetSimdVector_simd16(pa, pa.cur, slot); @@ -1365,7 +1369,7 @@ void PaTriFanSingle0(PA_STATE_OPT& pa, uint32_t slot, uint32_t primIndex, __m128 verts[2] = swizzleLaneN(c, primIndex - 14); } #else - const simdvector &a = PaGetSimdVector(pa, pa.first, slot); + const simdvector &a = pa.leadingVertex.attrib[slot]; const simdvector &b = PaGetSimdVector(pa, pa.prev, slot); const simdvector &c = PaGetSimdVector(pa, pa.cur, slot); -- 2.30.2