[Mesa-dev] [PATCH 1/5] radv: make use of the output usage mask in GS copy shader

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Sep 13 13:57:58 UTC 2018


This is just for consistency because LLVM can detect and
remove unused loads.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_nir_to_llvm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c
index af34c548c15..fd7d69131f5 100644
--- a/src/amd/vulkan/radv_nir_to_llvm.c
+++ b/src/amd/vulkan/radv_nir_to_llvm.c
@@ -3618,6 +3618,9 @@ ac_gs_copy_shader_emit(struct radv_shader_context *ctx)
 		for (unsigned j = 0; j < length; j++) {
 			LLVMValueRef value, soffset;
 
+			if (!(output_usage_mask & (1 << j)))
+				continue;
+
 			soffset = LLVMConstInt(ctx->ac.i32,
 					       (slot * 4 + j) *
 					       ctx->gs_max_out_vertices * 16 * 4, false);
-- 
2.19.0



More information about the mesa-dev mailing list