zink: correct depth-bias enable condition
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 1 Nov 2022 12:30:27 +0000 (13:30 +0100)
committerMarge Bot <emma+marge@anholt.net>
Wed, 2 Nov 2022 14:30:58 +0000 (14:30 +0000)
This should be based on the fill_mode, not on the primitive type. We
*also* need to check if we'll rasterize triangles in the end, though.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19438>

src/gallium/drivers/zink/zink_draw.cpp
src/gallium/drivers/zink/zink_state.c
src/gallium/drivers/zink/zink_types.h

index 6d155d3..a6034fe 100644 (file)
@@ -681,23 +681,9 @@ zink_draw(struct pipe_context *pctx,
    }
 
    if (BATCH_CHANGED || rast_state_changed || rast_prim_changed) {
-      bool depth_bias = false;
-      switch (ctx->gfx_pipeline_state.rast_prim) {
-      case PIPE_PRIM_POINTS:
-         depth_bias = rast_state->offset_point;
-         break;
-
-      case PIPE_PRIM_LINES:
-         depth_bias = rast_state->offset_line;
-         break;
-
-      case PIPE_PRIM_TRIANGLES:
-         depth_bias = rast_state->offset_tri;
-         break;
-
-      default:
-         unreachable("unexpected reduced prim");
-      }
+      bool depth_bias =
+         ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_TRIANGLES &&
+         rast_state->offset_fill;
 
       VKCTX(CmdSetLineWidth)(batch->state->cmdbuf, rast_state->line_width);
       if (depth_bias) {
index a4f362f..8d0ba5d 100644 (file)
@@ -620,9 +620,7 @@ zink_create_rasterizer_state(struct pipe_context *pctx,
       state->base.line_stipple_pattern = UINT16_MAX;
    }
 
-   state->offset_point = rs_state->offset_point;
-   state->offset_line = rs_state->offset_line;
-   state->offset_tri = rs_state->offset_tri;
+   state->offset_fill = util_get_offset(rs_state, rs_state->fill_front);
    state->offset_units = rs_state->offset_units;
    if (!rs_state->offset_units_unscaled)
       state->offset_units *= 2;
index a9c3aeb..aa258bf 100644 (file)
@@ -293,7 +293,7 @@ struct zink_rasterizer_hw_state {
 
 struct zink_rasterizer_state {
    struct pipe_rasterizer_state base;
-   bool offset_point, offset_line, offset_tri;
+   bool offset_fill;
    float offset_units, offset_clamp, offset_scale;
    float line_width;
    VkFrontFace front_face;