[Mesa-dev] [PATCH v2 10/25] radeonsi: plumb the output vertex_stream through to si_shader_output_values

Nicolai Hähnle nhaehnle at gmail.com
Tue Dec 6 10:48:21 UTC 2016


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

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

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 49f1866..d010e01 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -50,20 +50,21 @@ static const char *scratch_rsrc_dword0_symbol =
 	"SCRATCH_RSRC_DWORD0";
 
 static const char *scratch_rsrc_dword1_symbol =
 	"SCRATCH_RSRC_DWORD1";
 
 struct si_shader_output_values
 {
 	LLVMValueRef values[4];
 	unsigned semantic_name;
 	unsigned semantic_index;
+	ubyte vertex_stream[4];
 };
 
 static void si_init_shader_ctx(struct si_shader_context *ctx,
 			       struct si_screen *sscreen,
 			       struct si_shader *shader,
 			       LLVMTargetMachineRef tm);
 
 static void si_llvm_emit_barrier(const struct lp_build_tgsi_action *action,
 				 struct lp_build_tgsi_context *bld_base,
 				 struct lp_build_emit_data *emit_data);
@@ -2789,25 +2790,29 @@ static void si_llvm_emit_vs_epilogue(struct lp_build_tgsi_context *bld_base)
 		}
 
 		if (cond)
 			lp_build_endif(&if_ctx);
 	}
 
 	for (i = 0; i < info->num_outputs; i++) {
 		outputs[i].semantic_name = info->output_semantic_name[i];
 		outputs[i].semantic_index = info->output_semantic_index[i];
 
-		for (j = 0; j < 4; j++)
+		for (j = 0; j < 4; j++) {
 			outputs[i].values[j] =
 				LLVMBuildLoad(gallivm->builder,
 					      ctx->soa.outputs[i][j],
 					      "");
+			outputs[i].vertex_stream[j] =
+				(info->output_streams[i] >> (2 * j)) & 3;
+		}
+
 	}
 
 	/* 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, "");
 
@@ -6244,20 +6249,23 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
 	args[8] = uint->zero; /* TFE */
 
 	/* Fetch vertex data from GSVS ring */
 	for (i = 0; i < gsinfo->num_outputs; ++i) {
 		unsigned chan;
 
 		outputs[i].semantic_name = gsinfo->output_semantic_name[i];
 		outputs[i].semantic_index = gsinfo->output_semantic_index[i];
 
 		for (chan = 0; chan < 4; chan++) {
+			outputs[i].vertex_stream[chan] =
+				(gsinfo->output_streams[i] >> (2 * chan)) & 3;
+
 			args[2] = lp_build_const_int32(gallivm,
 						       (i * 4 + chan) *
 						       gs_selector->gs_max_out_vertices * 16 * 4);
 
 			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),
-- 
2.7.4



More information about the mesa-dev mailing list