zink: reorder zink_bind_vertex_buffers()

we should be making this a no-op if we have no bindings (somehow)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9241>
This commit is contained in:
Mike Blumenkrantz 2020-09-28 14:13:12 -04:00
parent 381e92e811
commit a27570326f
1 changed files with 7 additions and 4 deletions

View File

@ -160,6 +160,10 @@ zink_bind_vertex_buffers(struct zink_batch *batch, struct zink_context *ctx)
VkBuffer buffers[PIPE_MAX_ATTRIBS];
VkDeviceSize buffer_offsets[PIPE_MAX_ATTRIBS];
const struct zink_vertex_elements_state *elems = ctx->element_state;
if (!elems->hw_state.num_bindings)
return;
for (unsigned i = 0; i < elems->hw_state.num_bindings; i++) {
struct pipe_vertex_buffer *vb = ctx->buffers + ctx->element_state->binding_map[i];
assert(vb);
@ -174,10 +178,9 @@ zink_bind_vertex_buffers(struct zink_batch *batch, struct zink_context *ctx)
}
}
if (elems->hw_state.num_bindings > 0)
vkCmdBindVertexBuffers(batch->cmdbuf, 0,
elems->hw_state.num_bindings,
buffers, buffer_offsets);
vkCmdBindVertexBuffers(batch->cmdbuf, 0,
elems->hw_state.num_bindings,
buffers, buffer_offsets);
}
static struct zink_compute_program *