zink: start using ctx->vertex_state_changed again

SetVertexInput is a heavy call.

also move this call outside zink_bind_vertex_buffers() since it doesn't
use any of the same data and was invoking unnecessary loops

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33849>
This commit is contained in:
Mike Blumenkrantz 2025-02-11 08:46:20 -05:00 committed by Marge Bot
parent f136f8ddd7
commit 540d35b27f
3 changed files with 6 additions and 7 deletions

View file

@ -147,11 +147,6 @@ zink_bind_vertex_buffers(struct zink_context *ctx)
elems->hw_state.num_bindings,
buffers, buffer_offsets);
if (DYNAMIC_STATE == ZINK_DYNAMIC_VERTEX_INPUT2 || DYNAMIC_STATE == ZINK_DYNAMIC_VERTEX_INPUT)
VKCTX(CmdSetVertexInputEXT)(ctx->bs->cmdbuf,
elems->hw_state.num_bindings, elems->hw_state.dynbindings,
elems->hw_state.num_attribs, elems->hw_state.dynattribs);
ctx->vertex_buffers_dirty = false;
}
@ -730,6 +725,10 @@ zink_draw(struct pipe_context *pctx,
else
zink_bind_vertex_buffers<ZINK_NO_DYNAMIC_STATE>(ctx);
}
if ((DYNAMIC_STATE == ZINK_DYNAMIC_VERTEX_INPUT2 || DYNAMIC_STATE == ZINK_DYNAMIC_VERTEX_INPUT) && (BATCH_CHANGED || ctx->vertex_state_changed))
VKCTX(CmdSetVertexInputEXT)(ctx->bs->cmdbuf,
ctx->element_state->hw_state.num_bindings, ctx->element_state->hw_state.dynbindings,
ctx->element_state->hw_state.num_attribs, ctx->element_state->hw_state.dynattribs);
}
if (BATCH_CHANGED) {
@ -830,6 +829,7 @@ zink_draw(struct pipe_context *pctx,
}
VKCTX(CmdBeginTransformFeedbackEXT)(bs->cmdbuf, 0, ctx->num_so_targets, counter_buffers, counter_buffer_offsets);
}
ctx->vertex_state_changed = false;
bool marker = false;
if (unlikely(zink_tracing)) {

View file

@ -166,7 +166,6 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
state->modules_changed = false;
state->uses_dynamic_stride = uses_dynamic_stride;
state->idx = idx;
ctx->vertex_state_changed = false;
const int rp_idx = state->render_pass ? 1 : 0;
/* shortcut for reusing previous pipeline across program changes */

View file

@ -186,7 +186,7 @@ zink_bind_vertex_elements_state(struct pipe_context *pctx,
ctx->element_state = cso;
if (cso) {
if (state->element_state != &ctx->element_state->hw_state) {
ctx->vertex_state_changed = !zink_screen(pctx->screen)->info.have_EXT_vertex_input_dynamic_state;
ctx->vertex_state_changed = true;
ctx->vertex_buffers_dirty = ctx->element_state->hw_state.num_bindings > 0;
}
state->element_state = &ctx->element_state->hw_state;