mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 01:38:06 +02:00
zink: Store zink_vertex_elements_hw_state::b.strides by binding id
Currently, we store strides by vertex buffer id, which means that we have
to map the binding index to the vertex buffer index every time we want to
get a stride for a given binding. This also creates an order mismatch when
we pass strides directly to CmdBindVertexBuffers2EXT. Instead of converting
strides for CmdBindVertexBuffers2EXT too, we can just store strides by
binding id, and drop the mapping in other places.
Fixes: 76725452 ("gallium: move vertex stride to CSO")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9817
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25305>
This commit is contained in:
parent
2993853f49
commit
465644640a
3 changed files with 5 additions and 5 deletions
|
|
@ -132,7 +132,7 @@ bind_vertex_buffers_dgc(struct zink_context *ctx)
|
|||
assert(res->obj->bda);
|
||||
ptr->bufferAddress = res->obj->bda + vb->buffer_offset;
|
||||
ptr->size = res->base.b.width0;
|
||||
ptr->stride = ctx->element_state->hw_state.b.strides[ctx->element_state->hw_state.binding_map[i]];
|
||||
ptr->stride = ctx->element_state->hw_state.b.strides[i];
|
||||
} else {
|
||||
ptr->bufferAddress = 0;
|
||||
ptr->size = 0;
|
||||
|
|
@ -151,7 +151,7 @@ zink_bind_vertex_buffers(struct zink_batch *batch, struct zink_context *ctx)
|
|||
struct zink_screen *screen = zink_screen(ctx->base.screen);
|
||||
|
||||
for (unsigned i = 0; i < elems->hw_state.num_bindings; i++) {
|
||||
struct pipe_vertex_buffer *vb = ctx->vertex_buffers + ctx->element_state->hw_state.binding_map[i];
|
||||
struct pipe_vertex_buffer *vb = ctx->vertex_buffers + elems->hw_state.binding_map[i];
|
||||
assert(vb);
|
||||
if (vb->buffer.resource) {
|
||||
struct zink_resource *res = zink_resource(vb->buffer.resource);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ check_vertex_strides(struct zink_context *ctx)
|
|||
const struct zink_vertex_elements_state *ves = ctx->element_state;
|
||||
for (unsigned i = 0; i < ves->hw_state.num_bindings; i++) {
|
||||
const struct pipe_vertex_buffer *vb = ctx->vertex_buffers + ves->hw_state.binding_map[i];
|
||||
unsigned stride = vb->buffer.resource ? ves->hw_state.b.strides[ves->hw_state.binding_map[i]] : 0;
|
||||
unsigned stride = vb->buffer.resource ? ves->hw_state.b.strides[i] : 0;
|
||||
if (stride && stride < ves->min_stride[i])
|
||||
return false;
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ zink_get_gfx_pipeline(struct zink_context *ctx,
|
|||
for (unsigned i = 0; i < state->element_state->num_bindings; i++) {
|
||||
const unsigned buffer_id = ctx->element_state->hw_state.binding_map[i];
|
||||
struct pipe_vertex_buffer *vb = ctx->vertex_buffers + buffer_id;
|
||||
state->vertex_strides[buffer_id] = vb->buffer.resource ? state->element_state->b.strides[buffer_id] : 0;
|
||||
state->vertex_strides[buffer_id] = vb->buffer.resource ? state->element_state->b.strides[i] : 0;
|
||||
hash = XXH32(&state->vertex_strides[buffer_id], sizeof(uint32_t), hash);
|
||||
}
|
||||
state->vertex_hash = hash ^ state->element_state->hash;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ zink_create_vertex_elements_state(struct pipe_context *pctx,
|
|||
ves->hw_state.attribs[i].binding = binding;
|
||||
ves->hw_state.attribs[i].location = i;
|
||||
ves->hw_state.attribs[i].format = format;
|
||||
ves->hw_state.b.strides[elem->vertex_buffer_index] = elem->src_stride;
|
||||
ves->hw_state.b.strides[binding] = elem->src_stride;
|
||||
assert(ves->hw_state.attribs[i].format != VK_FORMAT_UNDEFINED);
|
||||
ves->hw_state.attribs[i].offset = elem->src_offset;
|
||||
ves->min_stride[binding] = MAX2(ves->min_stride[binding], elem->src_offset + vk_format_get_blocksize(format));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue