mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 13:18:04 +02:00
zink: fix vertex-stride wrangling
Because Gallium and Vulkan disagree on what kind of state strides is, we need to wrangle this state a bit, and up until now, we've been simply fixing this up while binding the vertex-buffers. But this isn't robust, because the vertex element state might be bound after the vertex-buffer state was bound. We also need to take binding-map into account, which we're currently missing as well. Instead, w need to deal with this at a place where we know what's being used for both of these. So let's do this during draw instead. Ideally, we'd also do some dirty-tracking to know if this is needed or not, but I believe Mike has some patches in this areas lined up, so it might be easier to wait for those. Fixes:8d46e35d16("zink: introduce opengl over vulkan") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3661 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4125 Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8588> (cherry picked from commitd74b012260)
This commit is contained in:
parent
eaefaa9610
commit
7f76e0d4b2
3 changed files with 10 additions and 4 deletions
|
|
@ -130,7 +130,7 @@
|
|||
"description": "zink: fix vertex-stride wrangling",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": "8d46e35d16e3936968958bcab86d61967a673305"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -481,8 +481,6 @@ zink_set_vertex_buffers(struct pipe_context *pctx,
|
|||
for (int i = 0; i < num_buffers; ++i) {
|
||||
const struct pipe_vertex_buffer *vb = buffers + i;
|
||||
struct zink_resource *res = zink_resource(vb->buffer.resource);
|
||||
|
||||
ctx->gfx_pipeline_state.bindings[start_slot + i].stride = vb->stride;
|
||||
if (res && res->needs_xfb_barrier) {
|
||||
/* if we're binding a previously-used xfb buffer, we need cmd buffer synchronization to ensure
|
||||
* that we use the right buffer data
|
||||
|
|
@ -491,7 +489,6 @@ zink_set_vertex_buffers(struct pipe_context *pctx,
|
|||
res->needs_xfb_barrier = false;
|
||||
}
|
||||
}
|
||||
ctx->gfx_pipeline_state.dirty = true;
|
||||
}
|
||||
|
||||
util_set_vertex_buffers_mask(ctx->buffers, &ctx->buffers_enabled_mask,
|
||||
|
|
|
|||
|
|
@ -266,6 +266,15 @@ zink_draw_vbo(struct pipe_context *pctx,
|
|||
ctx->gfx_pipeline_state.dirty = true;
|
||||
ctx->gfx_pipeline_state.primitive_restart = !!dinfo->primitive_restart;
|
||||
|
||||
for (unsigned i = 0; i < ctx->element_state->hw_state.num_bindings; i++) {
|
||||
unsigned binding = ctx->element_state->binding_map[i];
|
||||
const struct pipe_vertex_buffer *vb = ctx->buffers + binding;
|
||||
if (ctx->gfx_pipeline_state.bindings[i].stride != vb->stride) {
|
||||
ctx->gfx_pipeline_state.bindings[i].stride = vb->stride;
|
||||
ctx->gfx_pipeline_state.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
VkPipeline pipeline = zink_get_gfx_pipeline(screen, gfx_program,
|
||||
&ctx->gfx_pipeline_state,
|
||||
dinfo->mode);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue