[Mesa-dev] [PATCH v2 18/25] radeonsi: fetch only outputs of current vertex stream from the GSVS ring
Nicolai Hähnle
nhaehnle at gmail.com
Tue Dec 6 10:48:29 UTC 2016
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/drivers/radeonsi/si_shader.c | 41 +++++++++++++++++++-------------
1 file changed, 25 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 5b1acc6..4200da5 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -6262,61 +6262,70 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
args[8] = uint->zero; /* TFE */
/* Fetch the vertex stream ID.*/
LLVMValueRef stream_id;
if (gs_selector->so.num_outputs)
stream_id = unpack_param(&ctx, ctx.param_streamout_config, 24, 2);
else
stream_id = uint->zero;
- /* Fetch vertex data from GSVS ring */
+ /* Fill in output information. */
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++) {
+ for (int 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),
- ctx.f32, "");
}
}
for (int stream = 0; stream < 4; stream++) {
struct lp_build_if_state if_ctx_stream;
if (!gsinfo->num_stream_output_components[stream])
continue;
if (stream > 0 && !gs_selector->so.num_outputs)
continue;
LLVMValueRef is_stream =
LLVMBuildICmp(builder, LLVMIntEQ,
stream_id,
lp_build_const_int32(gallivm, stream), "");
lp_build_if(&if_ctx_stream, gallivm, is_stream);
+ /* Fetch vertex data from GSVS ring */
+ for (i = 0; i < gsinfo->num_outputs; ++i) {
+ for (unsigned chan = 0; chan < 4; chan++) {
+ if (outputs[i].vertex_stream[chan] != stream) {
+ outputs[i].values[chan] = ctx.soa.bld_base.base.undef;
+ continue;
+ }
+
+ 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),
+ ctx.f32, "");
+ }
+ }
+
+ /* Streamout and exports. */
if (gs_selector->so.num_outputs) {
si_llvm_emit_streamout(&ctx, outputs,
gsinfo->num_outputs,
stream);
}
if (stream == 0)
si_llvm_export_vs(bld_base, outputs, gsinfo->num_outputs);
lp_build_endif(&if_ctx_stream);
--
2.7.4
More information about the mesa-dev
mailing list