22 VkPhysicalDevice physicalDevice,
24 uint32_t physicalDeviceVersion,
28#define SKGPU_COPY_FUNCTION(NAME) functions.vk##NAME = interface->fFunctions.f##NAME
29#define SKGPU_COPY_FUNCTION_KHR(NAME) functions.vk##NAME##KHR = interface->fFunctions.f##NAME
31 VmaVulkanFunctions functions;
34 std::memset(&functions, 0,
sizeof(VmaVulkanFunctions));
38 functions.vkGetInstanceProcAddr =
nullptr;
39 functions.vkGetDeviceProcAddr =
nullptr;
63 VmaAllocatorCreateInfo
info;
66 info.flags |= VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT;
71 info.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;
74 info.physicalDevice = physicalDevice;
80 info.preferredLargeHeapBlockSize = 4*1024*1024;
81 info.pAllocationCallbacks =
nullptr;
82 info.pDeviceMemoryCallbacks =
nullptr;
83 info.pHeapSizeLimit =
nullptr;
84 info.pVulkanFunctions = &functions;
89 info.pTypeExternalMemoryHandleTypes =
nullptr;
91 VmaAllocator allocator;
92 vmaCreateAllocator(&
info, &allocator);
97VulkanAMDMemoryAllocator::VulkanAMDMemoryAllocator(VmaAllocator allocator)
98 : fAllocator(allocator) {}
101 vmaDestroyAllocator(fAllocator);
106 uint32_t allocationPropertyFlags,
109 VmaAllocationCreateInfo
info;
111 info.usage = VMA_MEMORY_USAGE_UNKNOWN;
113 info.preferredFlags = 0;
114 info.memoryTypeBits = 0;
116 info.pUserData =
nullptr;
119 info.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
128 VmaAllocation allocation;
138 uint32_t allocationPropertyFlags,
141 VmaAllocationCreateInfo
info;
143 info.usage = VMA_MEMORY_USAGE_UNKNOWN;
144 info.memoryTypeBits = 0;
146 info.pUserData =
nullptr;
151 info.preferredFlags = 0;
173 info.preferredFlags = 0;
182 info.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
191 info.flags |= VMA_ALLOCATION_CREATE_MAPPED_BIT;
194 VmaAllocation allocation;
205 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
206 vmaFreeMemory(fAllocator, allocation);
211 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
212 VmaAllocationInfo vmaInfo;
213 vmaGetAllocationInfo(fAllocator, allocation, &vmaInfo);
216 vmaGetMemoryTypeProperties(fAllocator, vmaInfo.memoryType, &memFlags);
229 alloc->
fMemory = vmaInfo.deviceMemory;
230 alloc->
fOffset = vmaInfo.offset;
231 alloc->
fSize = vmaInfo.size;
239 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
240 return vmaMapMemory(fAllocator, allocation,
data);
245 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
246 vmaUnmapMemory(fAllocator, allocation);
252 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
253 return vmaFlushAllocation(fAllocator, allocation,
offset,
size);
259 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
260 return vmaInvalidateAllocation(fAllocator, allocation,
offset,
size);
264 VmaTotalStatistics
stats;
265 vmaCalculateStatistics(fAllocator, &
stats);
266 return {
stats.total.statistics.blockBytes,
stats.total.statistics.allocationBytes};
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static constexpr bool SkToBool(const T &x)
#define TRACE_EVENT0_ALWAYS(category_group, name)
#define SKGPU_COPY_FUNCTION_KHR(NAME)
#define SKGPU_COPY_FUNCTION(NAME)
void getAllocInfo(const VulkanBackendMemory &, VulkanAlloc *) const override
void freeMemory(const VulkanBackendMemory &) override
VkResult mapMemory(const VulkanBackendMemory &, void **data) override
VkResult allocateBufferMemory(VkBuffer buffer, BufferUsage usage, uint32_t allocationPropertyFlags, skgpu::VulkanBackendMemory *) override
std::pair< uint64_t, uint64_t > totalAllocatedAndUsedMemory() const override
static sk_sp< VulkanMemoryAllocator > Make(VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device, uint32_t physicalDeviceVersion, const VulkanExtensions *extensions, const VulkanInterface *interface, ThreadSafe)
void unmapMemory(const VulkanBackendMemory &) override
~VulkanAMDMemoryAllocator() override
VkResult allocateImageMemory(VkImage image, uint32_t allocationPropertyFlags, skgpu::VulkanBackendMemory *) override
VkResult flushMemory(const VulkanBackendMemory &, VkDeviceSize offset, VkDeviceSize size) override
VkResult invalidateMemory(const VulkanBackendMemory &, VkDeviceSize offset, VkDeviceSize size) override
@ kLazyAllocation_AllocationPropertyFlag
@ kDedicatedAllocation_AllocationPropertyFlag
@ kProtected_AllocationPropertyFlag
@ kPersistentlyMapped_AllocationPropertyFlag
FlutterSemanticsFlag flags
static float min(float r, float g, float b)
sk_sp< const SkImage > image
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
intptr_t VulkanBackendMemory
static void usage(char *argv0)
VulkanBackendMemory fBackendMemory
std::shared_ptr< const fml::Mapping > data
#define TRACE_EVENT0(category_group, name)
VkFlags VkMemoryPropertyFlags
@ VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT
@ VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
@ VK_MEMORY_PROPERTY_PROTECTED_BIT
@ VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT
@ VK_MEMORY_PROPERTY_HOST_CACHED_BIT
@ VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
#define VK_MAKE_VERSION(major, minor, patch)
#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME
#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME