Mesa (staging/19.3): zink: emit line-width when using polygon line-mode

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 31 22:15:30 UTC 2019


Module: Mesa
Branch: staging/19.3
Commit: 5032575b94916513b4b1a22c0967241b600f9a70
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5032575b94916513b4b1a22c0967241b600f9a70

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Oct 30 13:57:21 2019 +0100

zink: emit line-width when using polygon line-mode

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 at collabora.com>
Fixes: 6d30abb4f14 ("zink: use dynamic state for line-width")
(cherry picked from commit b7674829a102b3e751e8d5fc9b29d9e9079dce4a)

---

 src/gallium/drivers/zink/zink_context.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c
index 9219d019811..8a9ea11bf5d 100644
--- a/src/gallium/drivers/zink/zink_context.c
+++ b/src/gallium/drivers/zink/zink_context.c
@@ -993,6 +993,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)
@@ -1156,7 +1175,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




More information about the mesa-commit mailing list