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: ea14579f3d ("nir: handle primitives with adjacency")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Antonino Maniscalco <antonino.maniscalco@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24780>
This commit is contained in:
Alyssa Rosenzweig
2023-08-18 13:10:37 -04:00
committed by Marge Bot
parent 04ba4059b7
commit fe4208ed4c

View File

@@ -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;