[Mesa-dev] [PATCH 6/9] radeonsi: don't write undefined output channels to LDS in LS

Marek Olšák maraeo at gmail.com
Tue Nov 21 17:30:33 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_shader.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index bca0ca9..16036e3 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -3169,20 +3169,23 @@ static void si_llvm_emit_ls_epilogue(struct lp_build_tgsi_context *bld_base)
 		 */
 		if (name == TGSI_SEMANTIC_LAYER ||
 		    name == TGSI_SEMANTIC_VIEWPORT_INDEX)
 			continue;
 
 		int param = si_shader_io_get_unique_index(name, index);
 		LLVMValueRef dw_addr = LLVMBuildAdd(ctx->ac.builder, base_dw_addr,
 					LLVMConstInt(ctx->i32, param * 4, 0), "");
 
 		for (chan = 0; chan < 4; chan++) {
+			if (!(info->output_usagemask[i] & (1 << chan)))
+				continue;
+
 			lds_store(bld_base, chan, dw_addr,
 				  LLVMBuildLoad(ctx->ac.builder, out_ptr[chan], ""));
 		}
 	}
 
 	if (ctx->screen->b.chip_class >= GFX9)
 		si_set_ls_return_value_for_tcs(ctx);
 }
 
 static void si_llvm_emit_es_epilogue(struct lp_build_tgsi_context *bld_base)
-- 
2.7.4



More information about the mesa-dev mailing list