[Mesa-dev] [PATCH 6/6] radv: don't lower indirect derefs

Connor Abbott connora at valvesoftware.com
Thu Jul 6 19:50:57 UTC 2017


From: Connor Abbott <cwabbott0 at gmail.com>

Radeonsi doesn't either. As of the last commit, these should be handled
properly as long as LLVM has scratch support. We also should use
nir_lower_io_to_temporaries() for inputs instead of generating an
if-ladder, since that should be more efficient.
---
 src/amd/vulkan/radv_pipeline.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 237e146..0991304 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -272,11 +272,17 @@ radv_shader_compile_to_nir(struct radv_device *device,
 
 	nir_shader_gather_info(nir, entry_point->impl);
 
-	nir_variable_mode indirect_mask = 0;
-	indirect_mask |= nir_var_shader_in;
-	indirect_mask |= nir_var_local;
+	if (device->llvm_supports_spill) {
+		nir_lower_io_to_temporaries(nir, entry_point->impl,
+					    false /* outputs */,
+					    true /* inputs */);
+	} else {
+		nir_variable_mode indirect_mask = 0;
+		indirect_mask |= nir_var_shader_in;
+		indirect_mask |= nir_var_local;
+		nir_lower_indirect_derefs(nir, indirect_mask);
+	}
 
-	nir_lower_indirect_derefs(nir, indirect_mask);
 
 	static const nir_lower_tex_options tex_options = {
 	  .lower_txp = ~0,
-- 
2.9.4



More information about the mesa-dev mailing list