aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2020-01-23 16:18:29 +1000
committerMarge Bot <[email protected]>2020-02-07 00:54:42 +0000
commit00c066e5a04eba9359411bac36d985d047be6ddf (patch)
tree3c7cef5b9d97b58f9deaa2e28292d0a1480a767e /src/gallium/auxiliary
parent0c77007c9db74c3859f75dcd5161396ae5c16772 (diff)
draw/gs: track emitted prims + verts per stream.
This adds tracking of the emitted prims/verts per-stream. Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3530>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r--src/gallium/auxiliary/draw/draw_gs.c20
-rw-r--r--src/gallium/auxiliary/draw/draw_llvm.c11
2 files changed, 14 insertions, 17 deletions
diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c
index 9f526ebb33c..9cfec4dcf11 100644
--- a/src/gallium/auxiliary/draw/draw_gs.c
+++ b/src/gallium/auxiliary/draw/draw_gs.c
@@ -326,18 +326,18 @@ llvm_fetch_gs_outputs(struct draw_geometry_shader *shader,
unsigned next_prim_boundary = shader->primitive_boundary;
for (i = 0; i < shader->vector_length; ++i) {
- int prims = shader->llvm_emitted_primitives[i];
+ int prims = shader->llvm_emitted_primitives[i + (stream * shader->vector_length)];
total_prims += prims;
max_prims_per_invocation = MAX2(max_prims_per_invocation, prims);
}
for (i = 0; i < shader->vector_length; ++i) {
- total_verts += shader->llvm_emitted_vertices[i];
+ total_verts += shader->llvm_emitted_vertices[i + (stream * shader->vector_length)];
}
- output_ptr += shader->stream[0].emitted_vertices * shader->vertex_size;
+ output_ptr += shader->stream[stream].emitted_vertices * shader->vertex_size;
for (i = 0; i < shader->vector_length - 1; ++i) {
int current_verts = shader->llvm_emitted_vertices[i];
- int next_verts = shader->llvm_emitted_vertices[i + 1];
+ int next_verts = shader->llvm_emitted_vertices[i + 1 + (stream * shader->vector_length)];
#if 0
int j;
for (j = 0; j < current_verts; ++j) {
@@ -377,18 +377,18 @@ llvm_fetch_gs_outputs(struct draw_geometry_shader *shader,
prim_idx = 0;
for (i = 0; i < shader->vector_length; ++i) {
- int num_prims = shader->llvm_emitted_primitives[i];
+ int num_prims = shader->llvm_emitted_primitives[i + (stream * shader->vector_length)];
for (j = 0; j < num_prims; ++j) {
int prim_length =
shader->llvm_prim_lengths[j][i];
- shader->stream[0].primitive_lengths[shader->stream[0].emitted_primitives + prim_idx] =
+ shader->stream[stream].primitive_lengths[shader->stream[stream].emitted_primitives + prim_idx] =
prim_length;
++prim_idx;
}
}
- shader->stream[0].emitted_primitives += total_prims;
- shader->stream[0].emitted_vertices += total_verts;
+ shader->stream[stream].emitted_primitives += total_prims;
+ shader->stream[stream].emitted_vertices += total_verts;
}
static void
@@ -878,8 +878,8 @@ draw_create_geometry_shader(struct draw_context *draw,
memset(gs->gs_input, 0, sizeof(struct draw_gs_inputs));
gs->llvm_prim_lengths = 0;
- gs->llvm_emitted_primitives = align_malloc(vector_size, vector_size);
- gs->llvm_emitted_vertices = align_malloc(vector_size, vector_size);
+ gs->llvm_emitted_primitives = align_malloc(vector_size * PIPE_MAX_VERTEX_STREAMS, vector_size);
+ gs->llvm_emitted_vertices = align_malloc(vector_size * PIPE_MAX_VERTEX_STREAMS, vector_size);
gs->llvm_prim_ids = align_malloc(vector_size, vector_size);
gs->fetch_outputs = llvm_fetch_gs_outputs;
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c
index d8831187eeb..0960124bafe 100644
--- a/src/gallium/auxiliary/draw/draw_llvm.c
+++ b/src/gallium/auxiliary/draw/draw_llvm.c
@@ -1609,13 +1609,10 @@ draw_gs_llvm_epilogue(const struct lp_build_gs_iface *gs_base,
draw_gs_jit_emitted_vertices(gallivm, variant->context_ptr);
LLVMValueRef emitted_prims_ptr =
draw_gs_jit_emitted_prims(gallivm, variant->context_ptr);
- LLVMValueRef zero = lp_build_const_int32(gallivm, 0);
-
- if (stream > 0)
- return;
-
- emitted_verts_ptr = LLVMBuildGEP(builder, emitted_verts_ptr, &zero, 0, "");
- emitted_prims_ptr = LLVMBuildGEP(builder, emitted_prims_ptr, &zero, 0, "");
+ LLVMValueRef stream_val = lp_build_const_int32(gallivm, stream);
+
+ emitted_verts_ptr = LLVMBuildGEP(builder, emitted_verts_ptr, &stream_val, 1, "");
+ emitted_prims_ptr = LLVMBuildGEP(builder, emitted_prims_ptr, &stream_val, 1, "");
LLVMBuildStore(builder, total_emitted_vertices_vec, emitted_verts_ptr);
LLVMBuildStore(builder, emitted_prims_vec, emitted_prims_ptr);