Mesa (main): ir3/nir: Lower indirect references of compact variables

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 9 10:04:47 UTC 2021


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Thu Jul  8 12:39:22 2021 +0200

ir3/nir: Lower indirect references of compact variables

Fixes Sascha Willems "tessellation" demo on Turnip (it contains
indirect dereference of tessellation levels).

Fixes: 643f2cb ("ir3, tu: Cleanup indirect i/o lowering")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11781>

---

 src/freedreno/ir3/ir3_nir.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index bab5d8faaee..eec8208ade3 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -332,6 +332,18 @@ ir3_nir_lower_io_to_temporaries(nir_shader *s)
 		NIR_PASS_V(s, nir_lower_var_copies);
 		NIR_PASS_V(s, nir_lower_global_vars_to_local);
 	}
+
+	/* Regardless of the above, we need to lower indirect references to
+	 * compact variables such as clip/cull distances because due to how
+	 * TCS<->TES IO works we cannot handle indirect accesses that "straddle"
+	 * vec4 components. nir_lower_indirect_derefs has a special case for
+	 * compact variables, so it will actually lower them even though we pass
+	 * in 0 modes.
+	 *
+	 * Using temporaries would be slightly better but
+	 * nir_lower_io_to_temporaries currently doesn't support TCS i/o.
+	 */
+	NIR_PASS_V(s, nir_lower_indirect_derefs, 0, UINT32_MAX);
 }
 
 void



More information about the mesa-commit mailing list