zink: force line strip out when emulating stipple
authorantonino <antonino.maniscalco@collabora.com>
Fri, 3 Feb 2023 14:43:09 +0000 (15:43 +0100)
committerMarge Bot <emma+marge@anholt.net>
Wed, 29 Mar 2023 19:18:40 +0000 (19:18 +0000)
Fixes a bug where, whenever a primtiive that has more than 2 vertices is rendered
with line stipple, the edge between the first and last vertex will have
stretched out stipple.

This happens because interpolation will occur between two non consecutive
stipple counters for the last edge
(which is between the last and first vertices).

Forcing `nir_create_passthrough_gs` to generate a line strip avoids
this because the last vertex will be duplicated and will have
the correct stipple counter for each edge.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21238>

src/gallium/drivers/zink/zink_program.c

index 4046473..d1f4184 100644 (file)
@@ -2254,7 +2254,7 @@ zink_set_primitive_emulation_keys(struct zink_context *ctx)
                ctx->gfx_stages[prev_vertex_stage]->nir,
                ctx->gfx_pipeline_state.gfx_prim_mode,
                lower_edge_flags,
-               false);
+               lower_line_stipple);
 
             struct zink_shader *shader = zink_shader_create(screen, nir, NULL);
             ctx->gfx_stages[prev_vertex_stage]->non_fs.generated_gs[ctx->gfx_pipeline_state.gfx_prim_mode] = shader;