pan/bi: Export bifrost_nir_lower_load_output
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 20 Feb 2023 03:47:24 +0000 (22:47 -0500)
committerMarge Bot <emma+marge@anholt.net>
Thu, 23 Mar 2023 23:53:46 +0000 (23:53 +0000)
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 <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20906>

src/panfrost/compiler/bifrost_compile.c
src/panfrost/compiler/bifrost_nir.h

index fae0c53..1d131d5 100644 (file)
@@ -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,
index ba02080..cf00582 100644 (file)
@@ -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);