From 4a954dff07e97e60aea5012859a304bc152144cc Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 28 Aug 2023 08:17:19 -0400 Subject: [PATCH] asahi,agx: Select layered rendering outputs These 2 are together Signed-off-by: Alyssa Rosenzweig --- src/asahi/compiler/agx_compile.c | 4 ++++ src/asahi/compiler/agx_compile.h | 3 +++ src/gallium/drivers/asahi/agx_state.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 04d8251..c6f36a5 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -2893,6 +2893,10 @@ agx_compile_shader_nir(nir_shader *nir, struct agx_shader_key *key, if (nir->info.stage == MESA_SHADER_VERTEX) { out->writes_psiz = nir->info.outputs_written & BITFIELD_BIT(VARYING_SLOT_PSIZ); + + out->writes_layer_viewport = + nir->info.outputs_written & (VARYING_BIT_LAYER | VARYING_BIT_VIEWPORT); + } else if (nir->info.stage == MESA_SHADER_FRAGMENT) { out->disable_tri_merging = nir->info.fs.needs_all_helper_invocations || nir->info.fs.needs_quad_helper_invocations || diff --git a/src/asahi/compiler/agx_compile.h b/src/asahi/compiler/agx_compile.h index a376bd0..91ec198 100644 --- a/src/asahi/compiler/agx_compile.h +++ b/src/asahi/compiler/agx_compile.h @@ -116,6 +116,9 @@ struct agx_shader_info { /* Does the shader write point size? */ bool writes_psiz; + /* Does the shader write layer and/or viewport index? Written together */ + bool writes_layer_viewport; + /* Does the shader control the sample mask? */ bool writes_sample_mask; diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 52b99d6..18b22a2 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -2848,6 +2848,8 @@ agx_encode_state(struct agx_batch *batch, uint8_t *out, bool is_lines, agx_ppp_push(&ppp, OUTPUT_SELECT, cfg) { cfg.varyings = !!fs->info.varyings.fs.nr_bindings; cfg.point_size = vs->info.writes_psiz; + cfg.viewport_target = vs->info.writes_layer_viewport; + cfg.render_target = vs->info.writes_layer_viewport; cfg.frag_coord_z = fs->info.varyings.fs.reads_z; } } -- 2.7.4