mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
zink: only rebind vertex buffers when necessary
Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10997>
This commit is contained in:
parent
906371153c
commit
59b6f5db36
4 changed files with 13 additions and 3 deletions
|
|
@ -857,6 +857,7 @@ zink_set_vertex_buffers(struct pipe_context *pctx,
|
|||
update_existing_vbo(ctx, slot);
|
||||
}
|
||||
}
|
||||
ctx->vertex_buffers_dirty = num_buffers > 0;
|
||||
util_set_vertex_buffers_mask(ctx->vertex_buffers, &ctx->gfx_pipeline_state.vertex_buffers_enabled_mask,
|
||||
buffers, start_slot, num_buffers,
|
||||
unbind_num_trailing_slots, take_ownership);
|
||||
|
|
@ -1706,6 +1707,7 @@ flush_batch(struct zink_context *ctx, bool sync)
|
|||
ctx->dirty_so_targets = true;
|
||||
ctx->descriptor_refs_dirty[0] = ctx->descriptor_refs_dirty[1] = true;
|
||||
ctx->pipeline_changed[0] = ctx->pipeline_changed[1] = true;
|
||||
ctx->vertex_buffers_dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2968,6 +2970,7 @@ rebind_buffer(struct zink_context *ctx, struct zink_resource *res)
|
|||
return;
|
||||
if (!did_ref)
|
||||
zink_batch_reference_resource_rw(&ctx->batch, res, false);
|
||||
ctx->vertex_buffers_dirty = true;
|
||||
zink_resource_buffer_barrier(ctx, NULL, res, VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT,
|
||||
VK_PIPELINE_STAGE_VERTEX_INPUT_BIT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,6 +197,7 @@ struct zink_context {
|
|||
uint16_t rp_clears_enabled;
|
||||
|
||||
struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
|
||||
bool vertex_buffers_dirty;
|
||||
|
||||
void *sampler_states[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
|
||||
struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ zink_bind_vertex_buffers(struct zink_batch *batch, struct zink_context *ctx)
|
|||
vkCmdBindVertexBuffers(batch->state->cmdbuf, 0,
|
||||
elems->hw_state.num_bindings,
|
||||
buffers, buffer_offsets);
|
||||
ctx->vertex_buffers_dirty = false;
|
||||
}
|
||||
|
||||
static struct zink_compute_program *
|
||||
|
|
@ -644,7 +645,8 @@ zink_draw_vbo(struct pipe_context *pctx,
|
|||
if (ctx->gfx_pipeline_state.blend_state->need_blend_constants)
|
||||
vkCmdSetBlendConstants(batch->state->cmdbuf, ctx->blend_constants);
|
||||
|
||||
zink_bind_vertex_buffers(batch, ctx);
|
||||
if (ctx->vertex_buffers_dirty || pipeline_changed)
|
||||
zink_bind_vertex_buffers(batch, ctx);
|
||||
|
||||
if (BITSET_TEST(ctx->gfx_stages[PIPE_SHADER_VERTEX]->nir->info.system_values_read, SYSTEM_VALUE_BASE_VERTEX)) {
|
||||
unsigned draw_mode_is_indexed = dinfo->index_size > 0;
|
||||
|
|
|
|||
|
|
@ -96,11 +96,15 @@ zink_bind_vertex_elements_state(struct pipe_context *pctx,
|
|||
struct zink_gfx_pipeline_state *state = &ctx->gfx_pipeline_state;
|
||||
ctx->element_state = cso;
|
||||
if (cso) {
|
||||
if (state->element_state != &ctx->element_state->hw_state)
|
||||
if (state->element_state != &ctx->element_state->hw_state) {
|
||||
state->vertex_state_dirty = true;
|
||||
ctx->vertex_buffers_dirty = ctx->element_state->hw_state.num_bindings > 0;
|
||||
}
|
||||
state->element_state = &ctx->element_state->hw_state;
|
||||
} else
|
||||
} else {
|
||||
state->element_state = NULL;
|
||||
ctx->vertex_buffers_dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue