[Mesa-dev] [PATCH 10/23] radeonsi: separate the call to si_llvm_emit_streamout from exports

Nicolai Hähnle nhaehnle at gmail.com
Wed Nov 30 13:35:12 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

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

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index b420a7b..4e61d73 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2268,24 +2268,20 @@ static void si_llvm_export_vs(struct lp_build_tgsi_context *bld_base,
 				&ctx->soa.bld_base.uint_bld;
 	LLVMValueRef args[9];
 	LLVMValueRef pos_args[4][9] = { { 0 } };
 	LLVMValueRef psize_value = NULL, edgeflag_value = NULL, layer_value = NULL, viewport_index_value = NULL;
 	unsigned semantic_name, semantic_index;
 	unsigned target;
 	unsigned param_count = 0;
 	unsigned pos_idx;
 	int i;
 
-	if (outputs && ctx->shader->selector->so.num_outputs) {
-		si_llvm_emit_streamout(ctx, outputs, noutput);
-	}
-
 	for (i = 0; i < noutput; i++) {
 		semantic_name = outputs[i].semantic_name;
 		semantic_index = outputs[i].semantic_index;
 		bool export_param = true;
 
 		switch (semantic_name) {
 		case TGSI_SEMANTIC_POSITION: /* ignore these */
 		case TGSI_SEMANTIC_PSIZE:
 		case TGSI_SEMANTIC_CLIPVERTEX:
 		case TGSI_SEMANTIC_EDGEFLAG:
@@ -2809,20 +2805,22 @@ static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context *bld_base)
 	}
 
 	/* Return the primitive ID from the LLVM function. */
 	ctx->return_value =
 		LLVMBuildInsertValue(gallivm->builder,
 				     ctx->return_value,
 				     bitcast(bld_base, TGSI_TYPE_FLOAT,
 					     get_primitive_id(bld_base, 0)),
 				     VS_EPILOG_PRIMID_LOC, "");
 
+	if (ctx->shader->selector->so.num_outputs)
+		si_llvm_emit_streamout(ctx, outputs, i);
 	si_llvm_export_vs(bld_base, outputs, i);
 	FREE(outputs);
 }
 
 struct si_ps_exports {
 	unsigned num;
 	LLVMValueRef args[10][9];
 };
 
 unsigned si_get_spi_shader_z_format(bool writes_z, bool writes_stencil,
@@ -6249,20 +6247,22 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
 			outputs[i].values[chan] =
 				LLVMBuildBitCast(gallivm->builder,
 						 lp_build_intrinsic(gallivm->builder,
 								 "llvm.SI.buffer.load.dword.i32.i32",
 								 ctx.i32, args, 9,
 								 LP_FUNC_ATTR_READONLY),
 						 ctx.f32, "");
 		}
 	}
 
+	if (gs_selector->so.num_outputs)
+		si_llvm_emit_streamout(&ctx, outputs, gsinfo->num_outputs);
 	si_llvm_export_vs(bld_base, outputs, gsinfo->num_outputs);
 
 	LLVMBuildRetVoid(gallivm->builder);
 
 	/* Dump LLVM IR before any optimization passes */
 	if (sscreen->b.debug_flags & DBG_PREOPT_IR &&
 	    r600_can_dump_shader(&sscreen->b, PIPE_SHADER_GEOMETRY))
 		LLVMDumpModule(bld_base->base.gallivm->module);
 
 	si_llvm_finalize_module(&ctx,
-- 
2.7.4



More information about the mesa-dev mailing list