18 VkPhysicalDevice physicalDevice,
20 uint32_t physicalDeviceVersion,
23#define SKGPU_COPY_FUNCTION(NAME) functions.vk##NAME = interface->fFunctions.f##NAME
24#define SKGPU_COPY_FUNCTION_KHR(NAME) functions.vk##NAME##KHR = interface->fFunctions.f##NAME
26 VmaVulkanFunctions functions;
29 memset(&functions, 0,
sizeof(VmaVulkanFunctions));
33 functions.vkGetInstanceProcAddr =
nullptr;
34 functions.vkGetDeviceProcAddr =
nullptr;
58 VmaAllocatorCreateInfo
info;
59 info.flags = VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT;
63 info.flags |= VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT;
66 info.physicalDevice = physicalDevice;
72 info.preferredLargeHeapBlockSize = 4 * 1024 * 1024;
73 info.pAllocationCallbacks =
nullptr;
74 info.pDeviceMemoryCallbacks =
nullptr;
75 info.pHeapSizeLimit =
nullptr;
76 info.pVulkanFunctions = &functions;
81 info.pTypeExternalMemoryHandleTypes =
nullptr;
83 VmaAllocator allocator;
84 vmaCreateAllocator(&
info, &allocator);
89VkTestMemoryAllocator::VkTestMemoryAllocator(VmaAllocator allocator) : fAllocator(allocator) {}
92 vmaDestroyAllocator(fAllocator);
97 uint32_t allocationPropertyFlags,
100 VmaAllocationCreateInfo
info;
102 info.usage = VMA_MEMORY_USAGE_UNKNOWN;
104 info.preferredFlags = 0;
105 info.memoryTypeBits = 0;
107 info.pUserData =
nullptr;
110 info.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
119 VmaAllocation allocation;
129 uint32_t allocationPropertyFlags,
132 VmaAllocationCreateInfo
info;
134 info.usage = VMA_MEMORY_USAGE_UNKNOWN;
135 info.memoryTypeBits = 0;
137 info.pUserData =
nullptr;
142 info.preferredFlags = 0;
164 info.preferredFlags = 0;
173 info.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT;
182 info.flags |= VMA_ALLOCATION_CREATE_MAPPED_BIT;
185 VmaAllocation allocation;
196 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
197 vmaFreeMemory(fAllocator, allocation);
202 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
203 VmaAllocationInfo vmaInfo;
204 vmaGetAllocationInfo(fAllocator, allocation, &vmaInfo);
207 vmaGetMemoryTypeProperties(fAllocator, vmaInfo.memoryType, &memFlags);
220 alloc->
fMemory = vmaInfo.deviceMemory;
221 alloc->
fOffset = vmaInfo.offset;
222 alloc->
fSize = vmaInfo.size;
230 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
231 return vmaMapMemory(fAllocator, allocation,
data);
236 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
237 vmaUnmapMemory(fAllocator, allocation);
244 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
245 return vmaFlushAllocation(fAllocator, allocation,
offset,
size);
252 const VmaAllocation allocation = (VmaAllocation)memoryHandle;
253 return vmaInvalidateAllocation(fAllocator, allocation,
offset,
size);
257 VmaTotalStatistics
stats;
258 vmaCalculateStatistics(fAllocator, &
stats);
259 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)
~VkTestMemoryAllocator() override
void unmapMemory(const skgpu::VulkanBackendMemory &) override
VkResult invalidateMemory(const skgpu::VulkanBackendMemory &, VkDeviceSize offset, VkDeviceSize size) override
VkResult flushMemory(const skgpu::VulkanBackendMemory &, VkDeviceSize offset, VkDeviceSize size) override
static sk_sp< VulkanMemoryAllocator > Make(VkInstance instance, VkPhysicalDevice physicalDevice, VkDevice device, uint32_t physicalDeviceVersion, const skgpu::VulkanExtensions *extensions, const skgpu::VulkanInterface *interface)
VkResult allocateBufferMemory(VkBuffer buffer, BufferUsage usage, uint32_t allocationPropertyFlags, skgpu::VulkanBackendMemory *) override
std::pair< uint64_t, uint64_t > totalAllocatedAndUsedMemory() const override
void getAllocInfo(const skgpu::VulkanBackendMemory &, skgpu::VulkanAlloc *) const override
VkResult mapMemory(const skgpu::VulkanBackendMemory &, void **data) override
VkResult allocateImageMemory(VkImage image, uint32_t allocationPropertyFlags, skgpu::VulkanBackendMemory *) override
void freeMemory(const skgpu::VulkanBackendMemory &) 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