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 | |
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')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.cpp | 30 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_buffer_cache.h | 6 |
2 files changed, 16 insertions, 20 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()); }); } diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.h b/src/video_core/renderer_vulkan/vk_buffer_cache.h index 92d3e9f32..cdeef8846 100644 --- a/src/video_core/renderer_vulkan/vk_buffer_cache.h +++ b/src/video_core/renderer_vulkan/vk_buffer_cache.h @@ -97,10 +97,12 @@ public: void BindQuadIndexBuffer(PrimitiveTopology topology, u32 first, u32 count); void BindVertexBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size, u32 stride); - void BindVertexBuffers(VideoCommon::HostBindings& bindings); + + void BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bindings); void BindTransformFeedbackBuffer(u32 index, VkBuffer buffer, u32 offset, u32 size); - void BindTransformFeedbackBuffers(VideoCommon::HostBindings& bindings); + + void BindTransformFeedbackBuffers(VideoCommon::HostBindings<Buffer>& bindings); std::span<u8> BindMappedUniformBuffer([[maybe_unused]] size_t stage, [[maybe_unused]] u32 binding_index, u32 size) { |