zink: emit line-width when using polygon line-mode
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Wed, 30 Oct 2019 12:57:21 +0000 (13:57 +0100)
committerErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 31 Oct 2019 15:38:21 +0000 (15:38 +0000)
When switching this to dynamic state, I forgot that this also needs to
be emitted when we use a polygon-mode set to lines.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: 6d30abb4f14 ("zink: use dynamic state for line-width")
src/gallium/drivers/zink/zink_context.c

index 219605d90a3002236a26121b9ef92452dc81a777..61760d06cd168c7af6ed09a28bb465cc2ef2eb51 100644 (file)
@@ -1000,6 +1000,25 @@ get_gfx_program(struct zink_context *ctx)
    return ctx->curr_program;
 }
 
+static bool
+line_width_needed(enum pipe_prim_type reduced_prim,
+                  VkPolygonMode polygon_mode)
+{
+   switch (reduced_prim) {
+   case PIPE_PRIM_POINTS:
+      return false;
+
+   case PIPE_PRIM_LINES:
+      return true;
+
+   case PIPE_PRIM_TRIANGLES:
+      return polygon_mode == VK_POLYGON_MODE_LINE;
+
+   default:
+      unreachable("unexpected reduced prim");
+   }
+}
+
 static void
 zink_draw_vbo(struct pipe_context *pctx,
               const struct pipe_draw_info *dinfo)
@@ -1163,7 +1182,7 @@ zink_draw_vbo(struct pipe_context *pctx,
       vkCmdSetScissor(batch->cmdbuf, 0, 1, &fb_scissor);
    }
 
-   if (reduced_prim == PIPE_PRIM_LINES) {
+   if (line_width_needed(reduced_prim, rast_state->hw_state.polygon_mode)) {
       if (screen->feats.wideLines || ctx->line_width == 1.0f)
          vkCmdSetLineWidth(batch->cmdbuf, ctx->line_width);
       else