zink: fix VK_DYNAMIC_STATE_LINE_WIDTH usage

add a special tracker here to set the state only when necessary

Fixes: 659c39fafb ("zink: rework primitive rasterization type logic")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20886>
(cherry picked from commit 06a125942b)
This commit is contained in:
Mike Blumenkrantz 2023-01-25 09:24:16 -05:00 committed by Eric Engestrom
parent 3a65dc4f7f
commit 67f2d07eff
4 changed files with 10 additions and 3 deletions

View file

@ -346,7 +346,7 @@
"description": "zink: fix VK_DYNAMIC_STATE_LINE_WIDTH usage",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "659c39fafbb53e27e6816fa872ac6eb78772e519"
},

View file

@ -703,9 +703,11 @@ zink_draw(struct pipe_context *pctx,
}
}
if ((BATCH_CHANGED || rast_state_changed || rast_prim_changed) &&
ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_LINES) {
if (BATCH_CHANGED ||
/* only re-emit on non-batch change when actually drawing lines */
((ctx->line_width_changed || rast_prim_changed) && ctx->gfx_pipeline_state.rast_prim == PIPE_PRIM_LINES)) {
VKCTX(CmdSetLineWidth)(batch->state->cmdbuf, rast_state->line_width);
ctx->line_width_changed = false;
}
if (BATCH_CHANGED || mode_changed ||

View file

@ -623,6 +623,7 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
bool clip_halfz = ctx->rast_state ? ctx->rast_state->hw_state.clip_halfz : false;
bool rasterizer_discard = ctx->rast_state ? ctx->rast_state->base.rasterizer_discard : false;
bool half_pixel_center = ctx->rast_state ? ctx->rast_state->base.half_pixel_center : true;
float line_width = ctx->rast_state ? ctx->rast_state->base.line_width : 1.0;
ctx->rast_state = cso;
if (ctx->rast_state) {
@ -644,6 +645,9 @@ zink_bind_rasterizer_state(struct pipe_context *pctx, void *cso)
ctx->vp_state_changed = true;
}
if (fabs(ctx->rast_state->base.line_width - line_width) > FLT_EPSILON)
ctx->line_width_changed = true;
if (ctx->gfx_pipeline_state.dyn_state1.front_face != ctx->rast_state->front_face) {
ctx->gfx_pipeline_state.dyn_state1.front_face = ctx->rast_state->front_face;
ctx->gfx_pipeline_state.dirty |= !zink_screen(pctx->screen)->info.have_EXT_extended_dynamic_state;

View file

@ -1680,6 +1680,7 @@ struct zink_context {
bool blend_state_changed : 1;
bool sample_mask_changed : 1;
bool rast_state_changed : 1;
bool line_width_changed : 1;
bool dsa_state_changed : 1;
bool stencil_ref_changed : 1;
bool rasterizer_discard_changed : 1;