• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // vma_allocator_wrapper.h:
7 //    Hides VMA functions so we can use separate warning sets.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_VULKAN_VK_MEM_ALLOC_WRAPPER_H_
11 #define LIBANGLE_RENDERER_VULKAN_VK_MEM_ALLOC_WRAPPER_H_
12 
13 #include <volk.h>
14 
15 VK_DEFINE_HANDLE(VmaAllocator)
VK_DEFINE_HANDLE(VmaAllocation)16 VK_DEFINE_HANDLE(VmaAllocation)
17 
18 namespace vma
19 {
20 VkResult InitAllocator(VkPhysicalDevice physicalDevice,
21                        VkDevice device,
22                        VkInstance instance,
23                        VmaAllocator *pAllocator);
24 
25 void DestroyAllocator(VmaAllocator allocator);
26 
27 void FreeMemory(VmaAllocator allocator, VmaAllocation allocation);
28 
29 VkResult CreateBuffer(VmaAllocator allocator,
30                       const VkBufferCreateInfo *pBufferCreateInfo,
31                       VkMemoryPropertyFlags requiredFlags,
32                       VkMemoryPropertyFlags preferredFlags,
33                       bool persistentlyMappedBuffers,
34                       uint32_t *pMemoryTypeIndexOut,
35                       VkBuffer *pBuffer,
36                       VmaAllocation *pAllocation);
37 
38 void GetMemoryTypeProperties(VmaAllocator allocator,
39                              uint32_t memoryTypeIndex,
40                              VkMemoryPropertyFlags *pFlags);
41 
42 VkResult MapMemory(VmaAllocator allocator, VmaAllocation allocation, void **ppData);
43 
44 void UnmapMemory(VmaAllocator allocator, VmaAllocation allocation);
45 
46 void FlushAllocation(VmaAllocator allocator,
47                      VmaAllocation allocation,
48                      VkDeviceSize offset,
49                      VkDeviceSize size);
50 
51 void InvalidateAllocation(VmaAllocator allocator,
52                           VmaAllocation allocation,
53                           VkDeviceSize offset,
54                           VkDeviceSize size);
55 
56 }  // namespace vma
57 
58 #endif  // LIBANGLE_RENDERER_VULKAN_VK_MEM_ALLOC_WRAPPER_H_