diff options
author | Liam <byteslice@airmail.cc> | 2023-12-17 21:45:09 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-12-17 21:45:09 +0100 |
commit | fba3fa705d70f99aade208e230ad691d0a0b01cf (patch) | |
tree | 2df95a38903f61486708a1812049761436fa406d /src/video_core/renderer_vulkan | |
parent | Merge pull request #12378 from liamwhite/offsetof (diff) | |
download | yuzu-fba3fa705d70f99aade208e230ad691d0a0b01cf.tar yuzu-fba3fa705d70f99aade208e230ad691d0a0b01cf.tar.gz yuzu-fba3fa705d70f99aade208e230ad691d0a0b01cf.tar.bz2 yuzu-fba3fa705d70f99aade208e230ad691d0a0b01cf.tar.lz yuzu-fba3fa705d70f99aade208e230ad691d0a0b01cf.tar.xz yuzu-fba3fa705d70f99aade208e230ad691d0a0b01cf.tar.zst yuzu-fba3fa705d70f99aade208e230ad691d0a0b01cf.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index 5958f52f7..2267069e7 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp @@ -563,22 +563,27 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi } buffer_handles.push_back(handle); } + const u32 device_max = device.GetMaxVertexInputBindings(); + const u32 min_binding = std::min(bindings.min_index, device_max); + const u32 max_binding = std::min(bindings.max_index, device_max); + const u32 binding_count = max_binding - min_binding; + if (binding_count == 0) { + return; + } if (device.IsExtExtendedDynamicStateSupported()) { - scheduler.Record([this, bindings_ = std::move(bindings), - buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { - cmdbuf.BindVertexBuffers2EXT(bindings_.min_index, - std::min(bindings_.max_index - bindings_.min_index, - device.GetMaxVertexInputBindings()), - buffer_handles_.data(), bindings_.offsets.data(), - bindings_.sizes.data(), bindings_.strides.data()); + scheduler.Record([bindings_ = std::move(bindings), + buffer_handles_ = std::move(buffer_handles), + binding_count](vk::CommandBuffer cmdbuf) { + cmdbuf.BindVertexBuffers2EXT(bindings_.min_index, binding_count, buffer_handles_.data(), + bindings_.offsets.data(), bindings_.sizes.data(), + bindings_.strides.data()); }); } else { - scheduler.Record([this, bindings_ = std::move(bindings), - buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { - cmdbuf.BindVertexBuffers(bindings_.min_index, - std::min(bindings_.max_index - bindings_.min_index, - device.GetMaxVertexInputBindings()), - buffer_handles_.data(), bindings_.offsets.data()); + scheduler.Record([bindings_ = std::move(bindings), + buffer_handles_ = std::move(buffer_handles), + binding_count](vk::CommandBuffer cmdbuf) { + cmdbuf.BindVertexBuffers(bindings_.min_index, binding_count, buffer_handles_.data(), + bindings_.offsets.data()); }); } } |