v3dv: use pSizes paramater in vkCmdBindVertexBuffers2

We can use this to specify the maximum vertex index that can
be accessed, which the hardware will use to detect and prevent
out-of-bounds accesses to vertex buffers.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29425>
This commit is contained in:
Iago Toral Quiroga
2024-05-27 13:43:51 +02:00
parent 70aa470bdb
commit e00da33474
3 changed files with 21 additions and 3 deletions
+3 -1
View File
@@ -2620,7 +2620,9 @@ v3dX(cmd_buffer_emit_gl_shader_state)(struct v3dv_cmd_buffer *cmd_buffer)
attr.stride =
cmd_buffer->vk.dynamic_graphics_state.vi_binding_strides[binding];
attr.maximum_index = 0xffffff;
attr.maximum_index = attr.stride == 0 ?
1u : MIN2(0xffffffu, c_vb->size / attr.stride);
}
emitted_va_count++;