r600: fix points clipping

This is the backport of eca57f85ee ("radeonsi: fix
gl_ClipDistance and gl_ClipVertex for points").

This change was tested on rv770, palm, barts and cayman. It
fixes 450 khr-gl tests and 64 khr-gles tests on evergreen
and cayman gpus. Here is the list:
spec/glsl-1.20/execution/clipping/vs-clip-vertex-primitives: fail pass
spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives: fail pass
spec/glsl-1.50/execution/compatibility/clipping/gs-clip-vertex-primitives-points: fail pass
khr-gl(3[0-3]|4[0-5])/clip_distance/functional: fail pass
khr-gl(33|4[0-5])/cull_distance/functional_test_item_[0-8]_primitive_mode_points_max_culldist_[0-7]: fail pass
khr-gles3/clip_distance/functional: fail pass
khr-gles3/cull_distance/functional_test_item_[0-8]_primitive_mode_points_max_culldist_[0-7]: fail pass

Cc: mesa-stable
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34403>
This commit is contained in:
Patrick Lerda
2025-04-04 14:56:15 +02:00
committed by Marge Bot
parent 8fc01db1ac
commit 58ddf6aaf0
+13 -2
View File
@@ -2062,6 +2062,17 @@ void r600_emit_clip_misc_state(struct r600_context *rctx, struct r600_atom *atom
{
struct radeon_cmdbuf *cs = &rctx->b.gfx.cs;
struct r600_clip_misc_state *state = &rctx->clip_misc_state;
unsigned clipdist_mask = state->clip_dist_write;
unsigned culldist_mask = state->cull_dist_write;
/* 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 &= state->clip_plane_enable;
culldist_mask |= clipdist_mask;
radeon_set_context_reg(cs, R_028810_PA_CL_CLIP_CNTL,
state->pa_cl_clip_cntl |
@@ -2069,8 +2080,8 @@ void r600_emit_clip_misc_state(struct r600_context *rctx, struct r600_atom *atom
S_028810_CLIP_DISABLE(state->clip_disable));
radeon_set_context_reg(cs, R_02881C_PA_CL_VS_OUT_CNTL,
state->pa_cl_vs_out_cntl |
(state->clip_plane_enable & state->clip_dist_write) |
(state->cull_dist_write << 8));
clipdist_mask |
(culldist_mask << 8));
/* reuse needs to be set off if we write oViewport */
if (rctx->b.gfx_level >= EVERGREEN)
radeon_set_context_reg(cs, R_028AB4_VGT_REUSE_OFF,