zink: use correct primitives for passthrough gs with tess

When tessellation is used the geometry shader needs to take the
tessellator output primitive as input.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fixes: 90a8525d70 ("zink: handle edgeflags")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22498>
(cherry picked from commit c84989c4cf)
This commit is contained in:
antonino 2023-04-14 12:47:17 +02:00 committed by Eric Engestrom
parent 72969b2c87
commit 4ce4823f4e
2 changed files with 23 additions and 2 deletions

View file

@ -445,7 +445,7 @@
"description": "zink: use correct primitives for passthrough gs with tess",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "90a8525d703330b9d198ddf9579c560d0e5cadaa"
},

View file

@ -2222,6 +2222,24 @@ zink_rast_prim_for_pipe(enum pipe_prim_type prim)
}
}
static enum pipe_prim_type
zink_tess_prim_type(struct zink_shader *tess)
{
if (tess->info.tess.point_mode)
return PIPE_PRIM_POINTS;
else {
switch (tess->info.tess._primitive_mode) {
case TESS_PRIMITIVE_ISOLINES:
return PIPE_PRIM_LINES;
case TESS_PRIMITIVE_TRIANGLES:
case TESS_PRIMITIVE_QUADS:
return PIPE_PRIM_TRIANGLES;
default:
return PIPE_PRIM_MAX;
}
}
}
static inline void
zink_add_inline_uniform(nir_shader *shader, int offset)
{
@ -2320,10 +2338,13 @@ zink_set_primitive_emulation_keys(struct zink_context *ctx)
prev_stage,
ZINK_INLINE_VAL_PV_LAST_VERT * 4);
} else {
enum pipe_prim_type prim = ctx->gfx_pipeline_state.gfx_prim_mode;
if (prev_vertex_stage == MESA_SHADER_TESS_EVAL)
prim = zink_tess_prim_type(ctx->gfx_stages[MESA_SHADER_TESS_EVAL]);
nir = nir_create_passthrough_gs(
&screen->nir_options,
prev_stage,
ctx->gfx_pipeline_state.gfx_prim_mode,
prim,
ZINK_INLINE_VAL_FLAT_MASK * sizeof(uint32_t),
ZINK_INLINE_VAL_PV_LAST_VERT * sizeof(uint32_t),
lower_edge_flags,