[Mesa-dev] [PATCH v2 2/2] swr: supply proper clip distances to point sprites

Ilia Mirkin imirkin at alum.mit.edu
Fri Dec 9 02:21:23 UTC 2016


Large points become pairs of triangles when rasterized, so we must feed
it three clip distances, one for each vertex.

The clip distance is not subject to sprite coord replacement, so there's
no interpolation of it. We just take its value and put it in the "z"
component of the barycentric-ready plane equation.

(We could also just cull it at an earlier point in time, but that would
require larger changes.)

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
 src/gallium/drivers/swr/rasterizer/core/binner.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/binner.cpp b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
index 1538020..d5f2e97 100644
--- a/src/gallium/drivers/swr/rasterizer/core/binner.cpp
+++ b/src/gallium/drivers/swr/rasterizer/core/binner.cpp
@@ -1185,9 +1185,15 @@ void BinPoints(
             if (rastState.clipDistanceMask)
             {
                 uint32_t numClipDist = _mm_popcnt_u32(rastState.clipDistanceMask);
-                float one[2] = {1.0f, 1.0f};
-                desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 2 * sizeof(float));
-                ProcessUserClipDist<2>(pa, primIndex, rastState.clipDistanceMask, one, desc.pUserClipBuffer);
+                desc.pUserClipBuffer = (float*)pArena->Alloc(numClipDist * 3 * sizeof(float));
+                float dists[8];
+                float one = 1.0f;
+                ProcessUserClipDist<1>(pa, primIndex, rastState.clipDistanceMask, &one, dists);
+                for (uint32_t i = 0; i < numClipDist; i++) {
+                    desc.pUserClipBuffer[3*i + 0] = 0.0f;
+                    desc.pUserClipBuffer[3*i + 1] = 0.0f;
+                    desc.pUserClipBuffer[3*i + 2] = dists[i];
+                }
             }
 
             MacroTileMgr *pTileMgr = pDC->pTileMgr;
-- 
2.7.3



More information about the mesa-dev mailing list