From 2dfebf34874b5365156d254c2c1ba2ecc5262deb Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 20 Jan 2022 15:46:49 -0800 Subject: [PATCH] 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 Part-of: --- 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 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_emit.c b/src/gallium/drivers/freedreno/a5xx/fd5_emit.c index 30b656a53ea..b5120b50c50 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 ceda53ba91e..c55e3403bea 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);