diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2023-06-13 06:32:16 +0200 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2023-06-13 06:59:42 +0200 |
commit | 925586f97bb4a2f13b602d145cdd3aa00c7177fa (patch) | |
tree | a7bb918bf3dd173a571cb65ed3783c7d45d4be68 /src/video_core/renderer_vulkan/vk_buffer_cache.cpp | |
parent | Merge pull request #10746 from bunnei/update-android-settings (diff) | |
download | yuzu-925586f97bb4a2f13b602d145cdd3aa00c7177fa.tar yuzu-925586f97bb4a2f13b602d145cdd3aa00c7177fa.tar.gz yuzu-925586f97bb4a2f13b602d145cdd3aa00c7177fa.tar.bz2 yuzu-925586f97bb4a2f13b602d145cdd3aa00c7177fa.tar.lz yuzu-925586f97bb4a2f13b602d145cdd3aa00c7177fa.tar.xz yuzu-925586f97bb4a2f13b602d145cdd3aa00c7177fa.tar.zst yuzu-925586f97bb4a2f13b602d145cdd3aa00c7177fa.zip |
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_buffer_cache.cpp')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp index d72d99899..8c33722d3 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp @@ -501,11 +501,10 @@ void BufferCacheRuntime::BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset } } -void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) { +void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings) { boost::container::small_vector<VkBuffer, 32> buffer_handles; - for (u32 index = 0; index < bindings.buffers.size(); index++) { - auto& buffer = *reinterpret_cast<Buffer*>(bindings.buffers[index]); - auto handle = buffer.Handle(); + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + auto handle = bindings.buffers[index]->Handle(); if (handle == VK_NULL_HANDLE) { bindings.offsets[index] = 0; bindings.sizes[index] = VK_WHOLE_SIZE; @@ -521,16 +520,13 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings& bindings) buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { cmdbuf.BindVertexBuffers2EXT( bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(), - reinterpret_cast<const VkDeviceSize*>(bindings.offsets.data()), - reinterpret_cast<const VkDeviceSize*>(bindings.sizes.data()), - reinterpret_cast<const VkDeviceSize*>(bindings.strides.data())); + bindings.offsets.data(), bindings.sizes.data(), bindings.strides.data()); }); } else { scheduler.Record([bindings = bindings, buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { - cmdbuf.BindVertexBuffers( - bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(), - reinterpret_cast<const VkDeviceSize*>(bindings.offsets.data())); + cmdbuf.BindVertexBuffers(bindings.min_index, bindings.max_index - bindings.min_index, + buffer_handles.data(), bindings.offsets.data()); }); } } @@ -556,22 +552,20 @@ void BufferCacheRuntime::BindTransformFeedbackBuffer(u32 index, VkBuffer buffer, }); } -void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings) { +void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings) { if (!device.IsExtTransformFeedbackSupported()) { // Already logged in the rasterizer return; } boost::container::small_vector<VkBuffer, 4> buffer_handles; - for (u32 index = 0; index < bindings.buffers.size(); index++) { - auto& buffer = *reinterpret_cast<Buffer*>(bindings.buffers[index]); - buffer_handles.push_back(buffer.Handle()); + for (u32 index = 0; index < bindings.buffers.size(); ++index) { + buffer_handles.push_back(bindings.buffers[index]->Handle()); } scheduler.Record( [bindings = bindings, buffer_handles = buffer_handles](vk::CommandBuffer cmdbuf) { - cmdbuf.BindTransformFeedbackBuffersEXT( - 0, static_cast<u32>(buffer_handles.size()), buffer_handles.data(), - reinterpret_cast<const VkDeviceSize*>(bindings.offsets.data()), - reinterpret_cast<const VkDeviceSize*>(bindings.sizes.data())); + cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast<u32>(buffer_handles.size()), + buffer_handles.data(), bindings.offsets.data(), + bindings.sizes.data()); }); } |