Mesa (master): radeonsi: fix gl_ClipDistance and gl_ClipVertex for points

Nicolai Hähnle nh at kemper.freedesktop.org
Thu Dec 22 16:13:11 UTC 2016


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

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Thu Dec 15 12:19:07 2016 +0100

radeonsi: fix gl_ClipDistance and gl_ClipVertex for points

The clipper hardware doesn't consider points as primitives that can be
clipped. Simply setting the corresponding cull bits works, and should not
have an adverse effect on other primitive types according to the hardware
team.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

---

 src/gallium/drivers/radeonsi/si_state.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index afcd3ad..11f9fb8 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -678,6 +678,15 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom)
 	}
 	total_mask = clipdist_mask | culldist_mask;
 
+	/* Clip distances on points have no effect, so need to be implemented
+	 * as cull distances. This applies for the clipvertex case as well.
+	 *
+	 * Setting this for primitives other than points should have no adverse
+	 * effects.
+	 */
+	clipdist_mask &= rs->clip_plane_enable;
+	culldist_mask |= clipdist_mask;
+
 	misc_vec_ena = info->writes_psize || info->writes_edgeflag ||
 		       info->writes_layer || info->writes_viewport_index;
 
@@ -690,8 +699,7 @@ static void si_emit_clip_regs(struct si_context *sctx, struct r600_atom *atom)
 		S_02881C_VS_OUT_CCDIST1_VEC_ENA((total_mask & 0xF0) != 0) |
 		S_02881C_VS_OUT_MISC_VEC_ENA(misc_vec_ena) |
 		S_02881C_VS_OUT_MISC_SIDE_BUS_ENA(misc_vec_ena) |
-		(rs->clip_plane_enable &
-		 clipdist_mask) | (culldist_mask << 8));
+		clipdist_mask | (culldist_mask << 8));
 	radeon_set_context_reg(cs, R_028810_PA_CL_CLIP_CNTL,
 		rs->pa_cl_clip_cntl |
 		ucp_mask |




More information about the mesa-commit mailing list