#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "gpu/vulkan/vma_wrapper.h"
#include <algorithm>
#include <vk_mem_alloc.h>
#include "base/metrics/histogram_functions.h"
#include "build/build_config.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
namespace gpu {
namespace vma {
VkResult CreateAllocator(VkPhysicalDevice physical_device,
VkDevice device,
VkInstance instance,
const gfx::ExtensionSet& enabled_extensions,
const VkDeviceSize preferred_large_heap_block_size,
const VkDeviceSize* heap_size_limit,
const bool is_thread_safe,
VmaAllocator* pAllocator) { … }
void DestroyAllocator(VmaAllocator allocator) { … }
VkResult AllocateMemoryForImage(VmaAllocator allocator,
VkImage image,
const VmaAllocationCreateInfo* create_info,
VmaAllocation* allocation,
VmaAllocationInfo* allocation_info) { … }
VkResult AllocateMemoryForBuffer(VmaAllocator allocator,
VkBuffer buffer,
const VmaAllocationCreateInfo* create_info,
VmaAllocation* allocation,
VmaAllocationInfo* allocation_info) { … }
VkResult CreateBuffer(VmaAllocator allocator,
const VkBufferCreateInfo* buffer_create_info,
VkMemoryPropertyFlags required_flags,
VkMemoryPropertyFlags preferred_flags,
VkBuffer* buffer,
VmaAllocation* allocation) { … }
void DestroyBuffer(VmaAllocator allocator,
VkBuffer buffer,
VmaAllocation allocation) { … }
VkResult MapMemory(VmaAllocator allocator,
VmaAllocation allocation,
void** data) { … }
void UnmapMemory(VmaAllocator allocator, VmaAllocation allocation) { … }
void FreeMemory(VmaAllocator allocator, VmaAllocation allocation) { … }
VkResult FlushAllocation(VmaAllocator allocator,
VmaAllocation allocation,
VkDeviceSize offset,
VkDeviceSize size) { … }
VkResult InvalidateAllocation(VmaAllocator allocator,
VmaAllocation allocation,
VkDeviceSize offset,
VkDeviceSize size) { … }
void GetAllocationInfo(VmaAllocator allocator,
VmaAllocation allocation,
VmaAllocationInfo* allocation_info) { … }
void GetMemoryTypeProperties(VmaAllocator allocator,
uint32_t memory_type_index,
VkMemoryPropertyFlags* flags) { … }
void GetPhysicalDeviceProperties(
VmaAllocator allocator,
const VkPhysicalDeviceProperties** physical_device_properties) { … }
void GetBudget(VmaAllocator allocator, VmaBudget* budget) { … }
std::pair<uint64_t, uint64_t> GetTotalAllocatedAndUsedMemory(
VmaAllocator allocator) { … }
}
}