diff options
| author | Robin Kertels <robin.kertels@gmail.com> | 2022-11-16 19:12:05 +0100 |
|---|---|---|
| committer | Robin Kertels <robin.kertels@gmail.com> | 2022-11-29 23:14:23 +0100 |
| commit | df2e07ad29284bac890428a7020ff063e160f910 (patch) | |
| tree | 7537e88304e074f2f23a1c3e0b3ddc078a4fe105 /Source | |
| parent | 57b2ea663eb6da47a95d337e1e004b6d9c0d0a16 (diff) | |
VideoBackends:Vulkan: Fix incorrect barriers in StagingBuffer
HOST barriers need to be issued regardless of
whether the memory type is coherent
and we need to properly synchronize writes to the buffer.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp b/Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp index 19ca7dc8dd..c053ced700 100644 --- a/Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp +++ b/Source/Core/VideoBackends/Vulkan/StagingBuffer.cpp @@ -73,11 +73,6 @@ void StagingBuffer::InvalidateGPUCache(VkCommandBuffer command_buffer, VkPipelineStageFlagBits dest_pipeline_stage, VkDeviceSize offset, VkDeviceSize size) { - VkMemoryPropertyFlags flags = 0; - vmaGetAllocationMemoryProperties(g_vulkan_context->GetMemoryAllocator(), m_alloc, &flags); - if (flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) [[likely]] - return; - ASSERT((offset + size) <= m_size || (offset < m_size && size == VK_WHOLE_SIZE)); BufferMemoryBarrier(command_buffer, m_buffer, VK_ACCESS_HOST_WRITE_BIT, dest_access_flags, offset, size, VK_PIPELINE_STAGE_HOST_BIT, dest_pipeline_stage); @@ -88,25 +83,15 @@ void StagingBuffer::PrepareForGPUWrite(VkCommandBuffer command_buffer, VkPipelineStageFlagBits dst_pipeline_stage, VkDeviceSize offset, VkDeviceSize size) { - VkMemoryPropertyFlags flags = 0; - vmaGetAllocationMemoryProperties(g_vulkan_context->GetMemoryAllocator(), m_alloc, &flags); - if (flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) [[likely]] - return; - ASSERT((offset + size) <= m_size || (offset < m_size && size == VK_WHOLE_SIZE)); - BufferMemoryBarrier(command_buffer, m_buffer, 0, dst_access_flags, offset, size, - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, dst_pipeline_stage); + BufferMemoryBarrier(command_buffer, m_buffer, VK_ACCESS_MEMORY_WRITE_BIT, dst_access_flags, + offset, size, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, dst_pipeline_stage); } void StagingBuffer::FlushGPUCache(VkCommandBuffer command_buffer, VkAccessFlagBits src_access_flags, VkPipelineStageFlagBits src_pipeline_stage, VkDeviceSize offset, VkDeviceSize size) { - VkMemoryPropertyFlags flags = 0; - vmaGetAllocationMemoryProperties(g_vulkan_context->GetMemoryAllocator(), m_alloc, &flags); - if (flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) [[likely]] - return; - ASSERT((offset + size) <= m_size || (offset < m_size && size == VK_WHOLE_SIZE)); BufferMemoryBarrier(command_buffer, m_buffer, src_access_flags, VK_ACCESS_HOST_READ_BIT, offset, size, src_pipeline_stage, VK_PIPELINE_STAGE_HOST_BIT); |
