Since we're not using the nullDescriptor feature, we need to bind an actual buffer for all bindings that are accessed by the shader (VUID-vkCmdDraw-None-04007). If there's no buffer set for a stream, bind the null buffer instead.
Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/wined3d/context_vk.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 45133eabb69..e6dc5ea568b 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -2322,27 +2322,43 @@ static bool wined3d_context_vk_begin_render_pass(struct wined3d_context_vk *cont static void wined3d_context_vk_bind_vertex_buffers(struct wined3d_context_vk *context_vk, VkCommandBuffer vk_command_buffer, const struct wined3d_state *state, const struct wined3d_vk_info *vk_info) { + struct wined3d_device_vk *device_vk = wined3d_device_vk(context_vk->c.device); VkDeviceSize offsets[ARRAY_SIZE(state->streams)] = {0}; - VkBuffer buffers[ARRAY_SIZE(state->streams)]; + VkBuffer buffers[ARRAY_SIZE(state->streams)] = {0}; + struct wined3d_graphics_pipeline_key_vk *key; const struct wined3d_stream_state *stream; const VkDescriptorBufferInfo *buffer_info; + unsigned int i, first, count, binding; struct wined3d_buffer_vk *buffer_vk; struct wined3d_buffer *buffer; - unsigned int i, first, count;
- first = 0; - count = 0; - for (i = 0; i < ARRAY_SIZE(state->streams); ++i) + key = &context_vk->graphics.pipeline_key_vk; + for (i = 0; i < key->input_desc.vertexBindingDescriptionCount; ++i) { - stream = &state->streams[i]; - + binding = key->bindings[i].binding; + stream = &state->streams[binding]; if ((buffer = stream->buffer)) { buffer_vk = wined3d_buffer_vk(buffer); buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk); wined3d_context_vk_reference_bo(context_vk, &buffer_vk->bo); - buffers[count] = buffer_info->buffer; - offsets[count] = buffer_info->offset + stream->offset; + } + else + { + buffer_info = &device_vk->null_resources_vk.buffer_info; + wined3d_context_vk_reference_bo(context_vk, &device_vk->null_resources_vk.bo); + } + + buffers[binding] = buffer_info->buffer; + offsets[binding] = buffer_info->offset + stream->offset; + } + + first = 0; + count = 0; + for (i = 0; i < ARRAY_SIZE(state->streams); ++i) + { + if (buffers[i]) + { ++count; continue; }