5#include <vulkan/vulkan.h>
10 VkDeviceMemory mDeviceMemory;
15 VkDeviceSize mPaddedSize;
18 mDeviceMemory(VK_NULL_HANDLE),
30 return mDeviceMemory != VK_NULL_HANDLE;
53 VramMemoryChunk* AllocateChunk(uint64_t size);
54 bool FreeChunk(int64_t
id);
66 std::vector<VramMemoryChunk> mChunks;
67 VkDeviceMemory mDeviceMemory;
69 uint64_t mAvailableMemory;
70 uint64_t mLargestChunk;
78 static void Alloc(uint64_t size, uint64_t alignment, uint32_t memoryType, VramAllocation& outAllocation);
79 static void Free(VramAllocation& allocation);
81 static uint64_t GetNumBlocksAllocated();
82 static uint64_t GetNumAllocations();
83 static uint64_t GetNumAllocatedBytes();
85 static const uint64_t sDefaultBlockSize;
89 static VramMemoryBlock* AllocateBlock(uint64_t newBlockSize, uint32_t memoryType);
90 static void FreeBlock(VramMemoryBlock& block);
93 static std::vector<VramMemoryBlock> sBlocks;
94 static uint64_t sNumAllocations;
95 static uint64_t sNumAllocatedBytes;