v3dv: provide implementation for vkCmdBindVertexBuffers2

Mostly equal to vkCmdBindVertexBuffers, but adding strides, that with
VK_EXT_extended_dynamic_state become dynamic, and setting pSizes.

It is worth to note that at this moment we don't use
CmdBindVertexBuffers2 pSizes.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27609>
This commit is contained in:
Alejandro Piñeiro 2024-03-20 02:25:00 +01:00 committed by Marge Bot
parent f2236065b7
commit f4d426fae6
3 changed files with 18 additions and 10 deletions

View file

@ -3421,21 +3421,28 @@ v3dv_CmdPipelineBarrier2(VkCommandBuffer commandBuffer,
}
VKAPI_ATTR void VKAPI_CALL
v3dv_CmdBindVertexBuffers(VkCommandBuffer commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
const VkBuffer *pBuffers,
const VkDeviceSize *pOffsets)
v3dv_CmdBindVertexBuffers2(VkCommandBuffer commandBuffer,
uint32_t firstBinding,
uint32_t bindingCount,
const VkBuffer *pBuffers,
const VkDeviceSize *pOffsets,
const VkDeviceSize *pSizes,
const VkDeviceSize *pStrides)
{
V3DV_FROM_HANDLE(v3dv_cmd_buffer, cmd_buffer, commandBuffer);
struct v3dv_vertex_binding *vb = cmd_buffer->state.vertex_bindings;
/* We have to defer setting up vertex buffer since we need the buffer
* stride from the pipeline.
*/
assert(firstBinding + bindingCount <= MAX_VBS);
bool vb_state_changed = false;
if (pStrides) {
vk_cmd_set_vertex_binding_strides(&cmd_buffer->vk,
firstBinding, bindingCount,
pStrides);
struct vk_dynamic_graphics_state *dyn = &cmd_buffer->vk.dynamic_graphics_state;
if (BITSET_TEST(dyn->dirty, MESA_VK_DYNAMIC_VI_BINDING_STRIDES))
vb_state_changed = true;
}
/* FIXME: at this moment we don't do any thing with pSizes. */
for (uint32_t i = 0; i < bindingCount; i++) {
if (vb[firstBinding + i].buffer != v3dv_buffer_from_handle(pBuffers[i])) {
vb[firstBinding + i].buffer = v3dv_buffer_from_handle(pBuffers[i]);

View file

@ -2486,6 +2486,8 @@ v3dX(cmd_buffer_emit_gl_shader_state)(struct v3dv_cmd_buffer *cmd_buffer)
cs_loaded_any = true;
}
attr.stride =
cmd_buffer->vk.dynamic_graphics_state.vi_binding_strides[binding];
attr.maximum_index = 0xffffff;
}

View file

@ -656,7 +656,6 @@ pack_shader_state_attribute_record(struct v3dv_pipeline *pipeline,
attr.instance_divisor = MIN2(pipeline->vb[binding].instance_divisor,
0xffff);
attr.stride = pipeline->vb[binding].stride;
attr.type = get_attr_type(desc);
}
}