Module: Mesa
Branch: master
Commit: 974c4a17001bb27673c39048a335c5f3141acbfd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=974c4a17001bb27673c39048a335c5f3141acbfd

Author: Marek Olšák <[email protected]>
Date:   Sun Feb  7 19:08:51 2021 -0500

tgsi_to_nir: translate FBFETCH

Tested by u_tests.

Reviewed-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8906>

---

 src/gallium/auxiliary/nir/tgsi_to_nir.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/gallium/auxiliary/nir/tgsi_to_nir.c 
b/src/gallium/auxiliary/nir/tgsi_to_nir.c
index 334e77a4edf..ea0cca69799 100644
--- a/src/gallium/auxiliary/nir/tgsi_to_nir.c
+++ b/src/gallium/auxiliary/nir/tgsi_to_nir.c
@@ -685,6 +685,16 @@ ttn_src_for_file_and_index(struct ttn_compile *c, unsigned 
file, unsigned index,
       }
       break;
 
+   case TGSI_FILE_OUTPUT:
+      if (c->scan->processor == PIPE_SHADER_FRAGMENT) {
+         c->outputs[index]->data.fb_fetch_output = 1;
+         nir_deref_instr *deref = nir_build_deref_var(&c->build,
+                                                      c->outputs[index]);
+         return nir_src_for_ssa(nir_load_deref(&c->build, deref));
+      }
+      unreachable("unsupported output read");
+      break;
+
    case TGSI_FILE_CONSTANT: {
       nir_intrinsic_instr *load;
       nir_intrinsic_op op;
@@ -1785,6 +1795,7 @@ ttn_mem(struct ttn_compile *c, nir_alu_dest dest, 
nir_ssa_def **src)
 static const nir_op op_trans[TGSI_OPCODE_LAST] = {
    [TGSI_OPCODE_ARL] = 0,
    [TGSI_OPCODE_MOV] = nir_op_mov,
+   [TGSI_OPCODE_FBFETCH] = nir_op_mov,
    [TGSI_OPCODE_LIT] = 0,
    [TGSI_OPCODE_RCP] = nir_op_frcp,
    [TGSI_OPCODE_RSQ] = nir_op_frsq,

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to