diff --git a/backends/vulkan/runtime/api/containers/StagingBuffer.cpp b/backends/vulkan/runtime/api/containers/StagingBuffer.cpp index ca020ab6572..499f0b43d05 100644 --- a/backends/vulkan/runtime/api/containers/StagingBuffer.cpp +++ b/backends/vulkan/runtime/api/containers/StagingBuffer.cpp @@ -159,6 +159,11 @@ void StagingBuffer::cast_half_to_float_and_copy_from( for (size_t i = 0; i < numel; ++i) { dst[i] = half_to_float(src[i]); } + vmaFlushAllocation( + vulkan_buffer_.vma_allocator(), + vulkan_buffer_.allocation(), + 0u, + VK_WHOLE_SIZE); } void StagingBuffer::cast_float_to_half_and_copy_to( diff --git a/backends/vulkan/runtime/api/containers/StagingBuffer.h b/backends/vulkan/runtime/api/containers/StagingBuffer.h index d786d030b39..19060804693 100644 --- a/backends/vulkan/runtime/api/containers/StagingBuffer.h +++ b/backends/vulkan/runtime/api/containers/StagingBuffer.h @@ -88,6 +88,11 @@ class StagingBuffer final { for (size_t i = 0; i < numel; ++i) { dst[i] = static_cast(src[i]); } + vmaFlushAllocation( + vulkan_buffer_.vma_allocator(), + vulkan_buffer_.allocation(), + 0u, + VK_WHOLE_SIZE); } void cast_half_to_float_and_copy_from( @@ -109,6 +114,11 @@ class StagingBuffer final { template void cast_and_copy_to(DST_T* dst, const size_t numel) { VK_CHECK_COND(numel <= this->numel()); + vmaInvalidateAllocation( + vulkan_buffer_.vma_allocator(), + vulkan_buffer_.allocation(), + 0u, + VK_WHOLE_SIZE); const SRC_T* src = reinterpret_cast(data()); for (size_t i = 0; i < numel; ++i) { dst[i] = static_cast(src[i]);