Module: Mesa Branch: staging/21.3 Commit: 8f432b769819599872424fcde1a9fdd14790dbca URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f432b769819599872424fcde1a9fdd14790dbca
Author: Rob Clark <[email protected]> Date: Thu Jan 20 15:46:49 2022 -0800 freedreno/a5xx: Fix clip_mask The clip_mask needs to also take into account rast->clip_plane_enable Fixes: 99838513aee ("freedreno/a5xx: Add support for clip distances and use them for userclip.") Signed-off-by: Rob Clark <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14643> (cherry picked from commit 2dfebf34874b5365156d254c2c1ba2ecc5262deb) --- .pick_status.json | 2 +- src/gallium/drivers/freedreno/a5xx/fd5_emit.c | 2 +- src/gallium/drivers/freedreno/a5xx/fd5_program.c | 5 ++++- src/gallium/drivers/freedreno/a5xx/fd5_program.h | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 0b3573c6623..391a6a675ac 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -49,7 +49,7 @@ "description": "freedreno/a5xx: Fix clip_mask", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "99838513aee4aeb100ff82fa7e2424c2d8e4f845" }, diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c index 9e27308eb89..ec48d89e034 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c @@ -658,7 +658,7 @@ fd5_emit_state(struct fd_context *ctx, struct fd_ringbuffer *ring, OUT_RING(ring, A5XX_GRAS_CL_VPORT_ZSCALE_0(ctx->viewport.scale[2])); } - if (dirty & FD_DIRTY_PROG) + if (dirty & (FD_DIRTY_PROG | FD_DIRTY_RASTERIZER_CLIP_PLANE_ENABLE)) fd5_program_emit(ctx, ring, emit); if (dirty & FD_DIRTY_RASTERIZER) { diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_program.c b/src/gallium/drivers/freedreno/a5xx/fd5_program.c index 2236420cdf1..a5ed62afde5 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_program.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_program.c @@ -250,9 +250,12 @@ fd5_program_emit(struct fd_context *ctx, struct fd_ringbuffer *ring, setup_stages(emit, s); bool do_streamout = (s[VS].v->shader->stream_output.num_outputs > 0); - uint8_t clip_mask = s[VS].v->clip_mask, cull_mask = s[VS].v->cull_mask; + uint8_t clip_mask = s[VS].v->clip_mask, + cull_mask = s[VS].v->cull_mask; uint8_t clip_cull_mask = clip_mask | cull_mask; + clip_mask &= ctx->rasterizer->clip_plane_enable; + fssz = (s[FS].i->double_threadsize) ? FOUR_QUADS : TWO_QUADS; pos_regid = ir3_find_output_regid(s[VS].v, VARYING_SLOT_POS); diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_program.h b/src/gallium/drivers/freedreno/a5xx/fd5_program.h index 59c499e6dfd..bc31c74cfa3 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_program.h +++ b/src/gallium/drivers/freedreno/a5xx/fd5_program.h @@ -52,7 +52,7 @@ void fd5_emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so); void fd5_program_emit(struct fd_context *ctx, struct fd_ringbuffer *ring, - struct fd5_emit *emit); + struct fd5_emit *emit) in_dt; void fd5_prog_init(struct pipe_context *pctx);
