Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions backends/vulkan/runtime/api/containers/StagingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
10 changes: 10 additions & 0 deletions backends/vulkan/runtime/api/containers/StagingBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ class StagingBuffer final {
for (size_t i = 0; i < numel; ++i) {
dst[i] = static_cast<DST_T>(src[i]);
}
vmaFlushAllocation(
vulkan_buffer_.vma_allocator(),
vulkan_buffer_.allocation(),
0u,
VK_WHOLE_SIZE);
}

void cast_half_to_float_and_copy_from(
Expand All @@ -109,6 +114,11 @@ class StagingBuffer final {
template <typename SRC_T, typename DST_T>
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<const SRC_T*>(data());
for (size_t i = 0; i < numel; ++i) {
dst[i] = static_cast<DST_T>(src[i]);
Expand Down
Loading