From: Richard Huang Date: Tue, 4 Mar 2025 11:17:04 +0000 (+0000) Subject: Set correct VMA allocation flag based on the memory usage of the image X-Git-Tag: dali_2.4.9~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9e73f6776251b49848097ce2d321def12d2bc07;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git Set correct VMA allocation flag based on the memory usage of the image Change-Id: I1fa3ce0dce4f300167a945ed68422b17e6fdbeca --- diff --git a/dali/internal/graphics/vulkan-impl/vulkan-image-impl.cpp b/dali/internal/graphics/vulkan-impl/vulkan-image-impl.cpp index 835f922af..df3b7852c 100644 --- a/dali/internal/graphics/vulkan-impl/vulkan-image-impl.cpp +++ b/dali/internal/graphics/vulkan-impl/vulkan-image-impl.cpp @@ -92,9 +92,19 @@ void Image::Initialize(vk::MemoryPropertyFlags memoryProperties) { auto vmaAllocInfo = ::vma::AllocationCreateInfo{} .setPreferredFlags(memoryProperties) - .setFlags(::vma::AllocationCreateFlagBits::eHostAccessSequentialWrite) .setUsage(::vma::MemoryUsage::eAuto); + // If the image is an attachment, prefer dedicated memory + constexpr vk::ImageUsageFlags attachmentOnlyFlags = vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eDepthStencilAttachment; + if(mCreateInfo.usage & attachmentOnlyFlags) + { + vmaAllocInfo.setFlags(::vma::AllocationCreateFlagBits::eDedicatedMemory); + } + else + { + vmaAllocInfo.setFlags(::vma::AllocationCreateFlagBits::eHostAccessSequentialWrite); + } + mVmaAllocation = std::make_unique<::vma::Allocation>(); // This creates the image, allocates appropriate memory for it, and binds the buffer with the memory. ::vma::AllocationInfo allocationInfo;