From 655d955274abd24906d84543b49460e6094b6652 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 30 Dec 2024 09:49:20 -0800 Subject: [PATCH] Fix VK validation error when setting 0 vertex buffers. (#123) --- src/vulkan/vk-command.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/vulkan/vk-command.cpp b/src/vulkan/vk-command.cpp index a0d72cd..bfdeec3 100644 --- a/src/vulkan/vk-command.cpp +++ b/src/vulkan/vk-command.cpp @@ -670,7 +670,16 @@ void CommandRecorder::cmdSetRenderState(const commands::SetRenderState& cmd) vertexBuffers[i] = buffer->m_buffer.m_buffer; offsets[i] = state.vertexBuffers[i].offset; } - api.vkCmdBindVertexBuffers(m_cmdBuffer, (uint32_t)0, (uint32_t)state.vertexBufferCount, vertexBuffers, offsets); + if (state.vertexBufferCount > 0) + { + api.vkCmdBindVertexBuffers( + m_cmdBuffer, + (uint32_t)0, + (uint32_t)state.vertexBufferCount, + vertexBuffers, + offsets + ); + } } if (updateIndexBuffer)