From 5959178381f3a3e88d33f76426172e55c9884ddd Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 1 Jul 2020 17:45:18 -0400 Subject: [PATCH] zink: use util_draw_vbo_without_prim_restart for unsupported prim modes this fixes up primitive restart functionality for the primitive types that vulkan doesn't support using primitive restart with fixes #2873 Reviewed-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/zink/zink_draw.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/zink/zink_draw.c b/src/gallium/drivers/zink/zink_draw.c index d39a261e2e1..7e038d1eb52 100644 --- a/src/gallium/drivers/zink/zink_draw.c +++ b/src/gallium/drivers/zink/zink_draw.c @@ -197,6 +197,12 @@ line_width_needed(enum pipe_prim_type reduced_prim, } } +static inline bool +restart_supported(enum pipe_prim_type mode) +{ + return mode == PIPE_PRIM_LINE_STRIP || mode == PIPE_PRIM_TRIANGLE_STRIP || mode == PIPE_PRIM_TRIANGLE_FAN; +} + void zink_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *dinfo) @@ -209,6 +215,11 @@ zink_draw_vbo(struct pipe_context *pctx, VkDeviceSize counter_buffer_offsets[PIPE_MAX_SO_OUTPUTS] = {}; bool need_index_buffer_unref = false; + + if (dinfo->primitive_restart && !restart_supported(dinfo->mode)) { + util_draw_vbo_without_prim_restart(pctx, dinfo); + return; + } if (dinfo->mode >= PIPE_PRIM_QUADS || dinfo->mode == PIPE_PRIM_LINE_LOOP) { if (!u_trim_pipe_prim(dinfo->mode, (unsigned *)&dinfo->count)) @@ -223,7 +234,6 @@ zink_draw_vbo(struct pipe_context *pctx, if (!gfx_program) return; - /* this is broken for anything requiring primconvert atm */ ctx->gfx_pipeline_state.primitive_restart = !!dinfo->primitive_restart; VkPipeline pipeline = zink_get_gfx_pipeline(screen, gfx_program, -- 2.30.2