zink: correct depth-bias enable condition

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>
This commit is contained in:
Erik Faye-Lund 2022-11-01 13:30:27 +01:00 committed by Marge Bot
parent b78afc2c73
commit 53721827ea
3 changed files with 5 additions and 21 deletions

View 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) {

View 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;

View 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;