diff --git a/impeller/renderer/backend/vulkan/allocator_vk.cc b/impeller/renderer/backend/vulkan/allocator_vk.cc index 345a37bddd9a9..3adce1b42452a 100644 --- a/impeller/renderer/backend/vulkan/allocator_vk.cc +++ b/impeller/renderer/backend/vulkan/allocator_vk.cc @@ -251,8 +251,7 @@ ToVKTextureMemoryPropertyFlags(StorageMode mode, switch (mode) { case StorageMode::kHostVisible: return vk::MemoryPropertyFlagBits::eHostVisible | - vk::MemoryPropertyFlagBits::eDeviceLocal | - vk::MemoryPropertyFlagBits::eHostCoherent; + vk::MemoryPropertyFlagBits::eDeviceLocal; case StorageMode::kDevicePrivate: return vk::MemoryPropertyFlagBits::eDeviceLocal; case StorageMode::kDeviceTransient: @@ -266,25 +265,16 @@ ToVKTextureMemoryPropertyFlags(StorageMode mode, } static VmaAllocationCreateFlags ToVmaAllocationCreateFlags(StorageMode mode, - bool is_texture, size_t size) { VmaAllocationCreateFlags flags = 0; switch (mode) { case StorageMode::kHostVisible: - if (is_texture) { - if (size >= kImageSizeThresholdForDedicatedMemoryAllocation) { - flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT; - } else { - flags |= {}; - } - } else { - flags |= VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT; - flags |= VMA_ALLOCATION_CREATE_MAPPED_BIT; + if (size >= kImageSizeThresholdForDedicatedMemoryAllocation) { + flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT; } return flags; case StorageMode::kDevicePrivate: - if (is_texture && - size >= kImageSizeThresholdForDedicatedMemoryAllocation) { + if (size >= kImageSizeThresholdForDedicatedMemoryAllocation) { flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT; } return flags; @@ -328,9 +318,8 @@ class AllocatedTextureSourceVK final : public TextureSourceVK { alloc_nfo.preferredFlags = static_cast(ToVKTextureMemoryPropertyFlags( desc.storage_mode, supports_memoryless_textures)); - alloc_nfo.flags = - ToVmaAllocationCreateFlags(desc.storage_mode, /*is_texture=*/true, - desc.GetByteSizeOfBaseMipLevel()); + alloc_nfo.flags = ToVmaAllocationCreateFlags( + desc.storage_mode, desc.GetByteSizeOfBaseMipLevel()); auto create_info_native = static_cast(image_info); diff --git a/impeller/renderer/backend/vulkan/device_buffer_vk.cc b/impeller/renderer/backend/vulkan/device_buffer_vk.cc index 5386ae3c037e8..02dc00d21686a 100644 --- a/impeller/renderer/backend/vulkan/device_buffer_vk.cc +++ b/impeller/renderer/backend/vulkan/device_buffer_vk.cc @@ -40,6 +40,9 @@ bool DeviceBufferVK::OnCopyHostBuffer(const uint8_t* source, if (source) { ::memmove(dest + offset, source + source_range.offset, source_range.length); } + ::vmaFlushAllocation(resource_->buffer.get().allocator, + resource_->buffer.get().allocation, offset, + source_range.length); return true; }