From 24693d8a7c13d732a1c3b88dcf3ed1ff97a29cf8 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sun, 19 Feb 2023 22:47:24 -0500 Subject: [PATCH] pan/bi: Export bifrost_nir_lower_load_output If new load_output are created after preprocessing NIR (namely, from blend lowering in panvk), this lowering needs to be called to lower load_output to the vendor intrinsic with conversion descriptor. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/compiler/bifrost_compile.c | 13 +++++++++++-- src/panfrost/compiler/bifrost_nir.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index fae0c53fc2d..1d131d51f7e 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -4674,6 +4674,16 @@ bi_lower_load_output(nir_builder *b, nir_instr *instr, UNUSED void *data) return true; } +bool +bifrost_nir_lower_load_output(nir_shader *nir) +{ + assert(nir->info.stage == MESA_SHADER_FRAGMENT); + + return nir_shader_instructions_pass( + nir, bi_lower_load_output, + nir_metadata_block_index | nir_metadata_dominance, NULL); +} + void bifrost_preprocess_nir(nir_shader *nir, unsigned gpu_id) { @@ -4730,8 +4740,7 @@ bifrost_preprocess_nir(nir_shader *nir, unsigned gpu_id) NIR_PASS_V(nir, nir_shader_instructions_pass, bi_lower_sample_mask_writes, nir_metadata_block_index | nir_metadata_dominance, NULL); - NIR_PASS_V(nir, nir_shader_instructions_pass, bi_lower_load_output, - nir_metadata_block_index | nir_metadata_dominance, NULL); + NIR_PASS_V(nir, bifrost_nir_lower_load_output); } else if (nir->info.stage == MESA_SHADER_VERTEX) { if (gpu_id >= 0x9000) { NIR_PASS_V(nir, nir_lower_mediump_io, nir_var_shader_out, diff --git a/src/panfrost/compiler/bifrost_nir.h b/src/panfrost/compiler/bifrost_nir.h index ba0208012b8..cf005826448 100644 --- a/src/panfrost/compiler/bifrost_nir.h +++ b/src/panfrost/compiler/bifrost_nir.h @@ -28,3 +28,4 @@ bool bifrost_nir_lower_algebraic_late(nir_shader *shader); bool bifrost_nir_lower_xfb(nir_shader *shader); bool bifrost_nir_opt_boolean_bitwise(nir_shader *shader); +bool bifrost_nir_lower_load_output(nir_shader *nir);