diff --git a/impeller/renderer/backend/vulkan/allocator_vk.cc b/impeller/renderer/backend/vulkan/allocator_vk.cc index 23df6c1688140..1ba4202125b44 100644 --- a/impeller/renderer/backend/vulkan/allocator_vk.cc +++ b/impeller/renderer/backend/vulkan/allocator_vk.cc @@ -168,16 +168,12 @@ static constexpr VmaMemoryUsage ToVMAMemoryUsage() { } static constexpr VkMemoryPropertyFlags ToVKMemoryPropertyFlags( - StorageMode mode, - bool is_texture) { + StorageMode mode) { switch (mode) { case StorageMode::kHostVisible: - if (is_texture) { - return VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; - } else { - return VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; - } + // See https://github.com/flutter/flutter/issues/128556 . Some devices do + // not have support for coherent host memory so we don't request it here. + return VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; case StorageMode::kDevicePrivate: return VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; case StorageMode::kDeviceTransient: @@ -236,7 +232,7 @@ class AllocatedTextureSourceVK final : public TextureSourceVK { VmaAllocationCreateInfo alloc_nfo = {}; alloc_nfo.usage = ToVMAMemoryUsage(); - alloc_nfo.preferredFlags = ToVKMemoryPropertyFlags(desc.storage_mode, true); + alloc_nfo.preferredFlags = ToVKMemoryPropertyFlags(desc.storage_mode); alloc_nfo.flags = ToVmaAllocationCreateFlags(desc.storage_mode, true); auto create_info_native = @@ -366,8 +362,7 @@ std::shared_ptr AllocatorVK::OnCreateBuffer( VmaAllocationCreateInfo allocation_info = {}; allocation_info.usage = ToVMAMemoryUsage(); - allocation_info.preferredFlags = - ToVKMemoryPropertyFlags(desc.storage_mode, false); + allocation_info.preferredFlags = ToVKMemoryPropertyFlags(desc.storage_mode); allocation_info.flags = ToVmaAllocationCreateFlags(desc.storage_mode, false); VkBuffer buffer = {}; diff --git a/impeller/renderer/backend/vulkan/device_buffer_vk.cc b/impeller/renderer/backend/vulkan/device_buffer_vk.cc index e9859ff9390a5..cb84dcd5eff38 100644 --- a/impeller/renderer/backend/vulkan/device_buffer_vk.cc +++ b/impeller/renderer/backend/vulkan/device_buffer_vk.cc @@ -46,6 +46,9 @@ bool DeviceBufferVK::OnCopyHostBuffer(const uint8_t* source, if (source) { ::memmove(dest + offset, source + source_range.offset, source_range.length); } + // See https://github.com/flutter/flutter/issues/128556 . Some devices do not + // have support for coherent host memory and require an explicit flush. + ::vmaFlushAllocation(allocator_, allocation_, offset, source_range.length); return true; }