[Mesa-dev] [PATCH v2 2/2] swr: supply proper clip distances to point sprites
Rowley, Timothy O
timothy.o.rowley at intel.com
Fri Dec 9 03:22:28 UTC 2016
Reviewed-by: Tim Rowley <timothy.o.rowley at intel.com<mailto:timothy.o.rowley at intel.com>>
On Dec 8, 2016, at 8:21 PM, Ilia Mirkin <imirkin at alum.mit.edu<mailto:imirkin at alum.mit.edu>> wrote:
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<mailto: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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161209/836af951/attachment.html>
More information about the mesa-dev
mailing list