From fe4208ed4c9a08c7963caa287ae34e9357de68af Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 18 Aug 2023 13:10:37 -0400 Subject: [PATCH] nir/passthrough_gs: Correctly set vertices_in If the input primitive has adjacency, the output primitive will have fewer vertices than the input. For example, if we input TRIANGLE_STRIPS_ADJACENCY, we need to set vertices_in = 6 even though we'll output TRIANGLE_STRIPS with vertices_out = 3. Respect that, in order to correctly handle adjacency inputs. Fixes: ea14579f3dc ("nir: handle primitives with adjacency") Signed-off-by: Alyssa Rosenzweig Reviewed-by: Antonino Maniscalco Part-of: --- src/compiler/nir/nir_passthrough_gs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_passthrough_gs.c b/src/compiler/nir/nir_passthrough_gs.c index 6c0fea95e50..0386d1e5223 100644 --- a/src/compiler/nir/nir_passthrough_gs.c +++ b/src/compiler/nir/nir_passthrough_gs.c @@ -22,6 +22,7 @@ */ #include "util/u_memory.h" +#include "util/u_prim.h" #include "nir.h" #include "nir_builder.h" #include "nir_xfb_info.h" @@ -134,7 +135,7 @@ nir_create_passthrough_gs(const nir_shader_compiler_options *options, nir_shader *nir = b.shader; nir->info.gs.input_primitive = gs_in_prim_for_topology(primitive_type); nir->info.gs.output_primitive = (force_line_strip_out || emulate_edgeflags) ? MESA_PRIM_LINE_STRIP : original_our_prim; - nir->info.gs.vertices_in = vertices_out; + nir->info.gs.vertices_in = u_vertices_per_prim(primitive_type); nir->info.gs.vertices_out = needs_closing ? vertices_out + 1 : vertices_out; nir->info.gs.invocations = 1; nir->info.gs.active_stream_mask = 1;