From 87e57eae092162a80c882bdf73afd15ecbeb28df Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 14 Apr 2023 19:57:20 -0400 Subject: [PATCH] asahi: Rename no colour output to tag write disable Comparison with PowerVR's XML shows that this is the actual name... And it needs to be set a bit more carefully than "no colour output" in order to get correct behaviour for depth-only passes that use sample mask / discard. Fix the name first, the extra conditions will come when they're needed for multisampling. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 3 ++- src/asahi/compiler/agx_compile.h | 7 +++++-- src/asahi/lib/cmdbuf.xml | 2 +- src/gallium/drivers/asahi/agx_state.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 3bc3d990028..01c87ac6dd2 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -2376,7 +2376,8 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, out->writes_psiz = nir->info.outputs_written & BITFIELD_BIT(VARYING_SLOT_PSIZ); } else if (nir->info.stage == MESA_SHADER_FRAGMENT) { - out->no_colour_output = !(nir->info.outputs_written >> FRAG_RESULT_DATA0); + out->tag_write_disable = + !(nir->info.outputs_written >> FRAG_RESULT_DATA0); out->disable_tri_merging = nir->info.fs.needs_all_helper_invocations || nir->info.fs.needs_quad_helper_invocations || nir->info.writes_memory; diff --git a/src/asahi/compiler/agx_compile.h b/src/asahi/compiler/agx_compile.h index dfc4a66c9f1..1cd392b6c4f 100644 --- a/src/asahi/compiler/agx_compile.h +++ b/src/asahi/compiler/agx_compile.h @@ -100,8 +100,11 @@ struct agx_shader_info { /* Depth layout, never equal to NONE */ enum gl_frag_depth_layout depth_layout; - /* Is colour output omitted? */ - bool no_colour_output; + /* Based only the compiled shader, should tag writes be disabled? This is set + * based on what is outputted. Note if rasterizer discard is used, that needs + * to disable tag writes regardless of this flag. + */ + bool tag_write_disable; /* Shader is incompatible with triangle merging */ bool disable_tri_merging; diff --git a/src/asahi/lib/cmdbuf.xml b/src/asahi/lib/cmdbuf.xml index 756c70a9512..7c61853848c 100644 --- a/src/asahi/lib/cmdbuf.xml +++ b/src/asahi/lib/cmdbuf.xml @@ -439,7 +439,7 @@ - + diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index a3bdb1d9466..f71fd9065ad 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -2332,8 +2332,8 @@ agx_encode_state(struct agx_batch *batch, uint8_t *out, bool is_lines, /* This avoids broken derivatives along primitive edges */ cfg.disable_tri_merging = (is_lines || is_points || ctx->fs->info.disable_tri_merging); - cfg.no_colour_output = ctx->fs->info.no_colour_output || - ctx->rast->base.rasterizer_discard; + cfg.tag_write_disable = ctx->fs->info.tag_write_disable || + ctx->rast->base.rasterizer_discard; cfg.pass_type = agx_pass_type_for_shader(&ctx->fs->info); } }