Mesa (main): nir_to_tgsi: Add support for FBFETCH.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 14 23:34:35 UTC 2022


Module: Mesa
Branch: main
Commit: b995a8eba4fa2d496d6cb6924956897f38c6b21d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b995a8eba4fa2d496d6cb6924956897f38c6b21d

Author: Emma Anholt <emma at anholt.net>
Date:   Wed Jan  5 11:40:32 2022 -0800

nir_to_tgsi: Add support for FBFETCH.

Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15014>

---

 src/gallium/auxiliary/nir/nir_to_tgsi.c      | 13 +++++++++----
 src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h |  2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index b55ca318efe..7caa971816c 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -2226,11 +2226,13 @@ ntt_emit_store_output(struct ntt_compile *c, nir_intrinsic_instr *instr)
 static void
 ntt_emit_load_output(struct ntt_compile *c, nir_intrinsic_instr *instr)
 {
-   /* ntt_try_store_in_tgsi_output() optimization is not valid if load_output
-    * is present.
+   nir_io_semantics semantics = nir_intrinsic_io_semantics(instr);
+
+   /* ntt_try_store_in_tgsi_output() optimization is not valid if normal
+    * load_output is present.
     */
    assert(c->s->info.stage != MESA_SHADER_VERTEX &&
-          c->s->info.stage != MESA_SHADER_FRAGMENT);
+          (c->s->info.stage != MESA_SHADER_FRAGMENT || semantics.fb_fetch_output));
 
    uint32_t frac;
    struct ureg_dst out = ntt_output_decl(c, instr, &frac);
@@ -2242,7 +2244,10 @@ ntt_emit_load_output(struct ntt_compile *c, nir_intrinsic_instr *instr)
       out = ntt_ureg_dst_indirect(c, out, instr->src[0]);
    }
 
-   ntt_MOV(c, ntt_get_dest(c, &instr->dest), ureg_src(out));
+   if (semantics.fb_fetch_output)
+      ntt_FBFETCH(c, ntt_get_dest(c, &instr->dest), ureg_src(out));
+   else
+      ntt_MOV(c, ntt_get_dest(c, &instr->dest), ureg_src(out));
 }
 
 static void
diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
index 272d865a2db..856f4a5c515 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h
@@ -204,6 +204,8 @@ OP11(INTERP_CENTROID)
 OP12(INTERP_SAMPLE)
 OP12(INTERP_OFFSET)
 
+OP11(FBFETCH)
+
 #undef OP00
 #undef OP01
 #undef OP10



More information about the mesa-commit mailing list