| 95 | } |
| 96 | |
| 97 | VkResult VkTestMemoryAllocator::allocateImageMemory(VkImage image, |
| 98 | uint32_t allocationPropertyFlags, |
| 99 | skgpu::VulkanBackendMemory* backendMemory) { |
| 100 | TRACE_EVENT0_ALWAYS("skia.gpu", TRACE_FUNC); |
| 101 | VmaAllocationCreateInfo info; |
| 102 | info.flags = 0; |
| 103 | info.usage = VMA_MEMORY_USAGE_UNKNOWN; |
| 104 | info.requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; |
| 105 | info.preferredFlags = 0; |
| 106 | info.memoryTypeBits = 0; |
| 107 | info.pool = VK_NULL_HANDLE; |
| 108 | info.pUserData = nullptr; |
| 109 | |
| 110 | if (kDedicatedAllocation_AllocationPropertyFlag & allocationPropertyFlags) { |
| 111 | info.flags |= VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT; |
| 112 | } |
| 113 | if (kLazyAllocation_AllocationPropertyFlag & allocationPropertyFlags) { |
| 114 | info.requiredFlags |= VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT; |
| 115 | } |
| 116 | if (kProtected_AllocationPropertyFlag & allocationPropertyFlags) { |
| 117 | info.requiredFlags |= VK_MEMORY_PROPERTY_PROTECTED_BIT; |
| 118 | } |
| 119 | |
| 120 | VmaAllocation allocation; |
| 121 | VkResult result = vmaAllocateMemoryForImage(fAllocator, image, &info, &allocation, nullptr); |
| 122 | if (VK_SUCCESS == result) { |
| 123 | *backendMemory = (skgpu::VulkanBackendMemory)allocation; |
| 124 | } |
| 125 | return result; |
| 126 | } |
| 127 | |
| 128 | VkResult VkTestMemoryAllocator::allocateBufferMemory(VkBuffer buffer, |
| 129 | BufferUsage usage, |
nothing calls this directly
no test coverage detected