From 563789ce3723facfb991f7153ef4740ccc1ef097 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Wed, 23 Sep 2020 11:29:28 +0200 Subject: [PATCH] ir3: Support geometry streams Part-of: --- src/freedreno/ir3/ir3_nir_lower_tess.c | 11 +++++++++++ src/freedreno/ir3/ir3_shader.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/src/freedreno/ir3/ir3_nir_lower_tess.c b/src/freedreno/ir3/ir3_nir_lower_tess.c index d54f9a4c928..6b3f95cbd88 100644 --- a/src/freedreno/ir3/ir3_nir_lower_tess.c +++ b/src/freedreno/ir3/ir3_nir_lower_tess.c @@ -836,6 +836,11 @@ lower_gs_block(nir_block *block, nir_builder *b, struct state *state) switch (intr->intrinsic) { case nir_intrinsic_end_primitive: { + /* Note: This ignores the stream, which seems to match the blob + * behavior. I'm guessing the HW ignores any extraneous cut + * signals from an EndPrimitive() that doesn't correspond to the + * rasterized stream. + */ b->cursor = nir_before_instr(&intr->instr); nir_store_var(b, state->vertex_flags_out, nir_imm_int(b, 4), 0x1); nir_instr_remove(&intr->instr); @@ -849,6 +854,12 @@ lower_gs_block(nir_block *block, nir_builder *b, struct state *state) nir_push_if(b, nir_ieq(b, count, local_thread_id(b))); + unsigned stream = nir_intrinsic_stream_id(intr); + /* vertex_flags_out |= stream */ + nir_store_var(b, state->vertex_flags_out, + nir_ior(b, nir_load_var(b, state->vertex_flags_out), + nir_imm_int(b, stream)), 0x1 /* .x */); + foreach_two_lists(dest_node, &state->emit_outputs, src_node, &state->old_outputs) { nir_variable *dest = exec_node_data(nir_variable, dest_node, node); nir_variable *src = exec_node_data(nir_variable, src_node, node); diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h index e1244240b8a..36aba4facc7 100644 --- a/src/freedreno/ir3/ir3_shader.h +++ b/src/freedreno/ir3/ir3_shader.h @@ -219,6 +219,10 @@ struct ir3_stream_output_info { /** stride for an entire vertex for each buffer in dwords */ uint16_t stride[IR3_MAX_SO_BUFFERS]; + /* These correspond to the VPC_SO_STREAM_CNTL fields */ + uint8_t streams_written; + uint8_t buffer_to_stream[IR3_MAX_SO_BUFFERS]; + /** * Array of stream outputs, in the order they are to be written in. * Selected components are tightly packed into the output buffer.