Mesa (master): swr: [rasterizer core] supply proper clip distances to point sprites

Ilia Mirkin imirkin at kemper.freedesktop.org
Fri Dec 9 03:49:24 UTC 2016


Module: Mesa
Branch: master
Commit: 429e2ec324674ba8c3412b331da56d9a8808cd38
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=429e2ec324674ba8c3412b331da56d9a8808cd38

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Thu Nov 24 13:27:48 2016 -0500

swr: [rasterizer core] supply proper clip distances to point sprites

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>
Reviewed-by: Tim Rowley <timothy.o.rowley at intel.com>

---

 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;




More information about the mesa-commit mailing list