From 0620c8e5e1f9d6e013427cdcfb9e0a31b8ad34b0 Mon Sep 17 00:00:00 2001 From: Adam Sawicki Date: Tue, 18 Aug 2020 16:43:44 +0200 Subject: [PATCH] Add test and documentation for resource aliasing (overlap). --- README.md | 1 + docs/gfx/Aliasing.png | Bin 0 -> 6208 bytes docs/html/allocation_annotation.html | 16 +- docs/html/choosing_memory_type.html | 16 +- docs/html/custom_memory_pools.html | 16 +- docs/html/defragmentation.html | 20 +- docs/html/index.html | 1 + docs/html/lost_allocations.html | 12 +- docs/html/memory_mapping.html | 20 +- docs/html/quick_start.html | 14 +- docs/html/resource_aliasing.html | 163 + docs/html/search/all_10.js | 2 +- docs/html/search/all_11.js | 16 +- docs/html/search/all_12.js | 308 +- docs/html/search/all_e.js | 3 +- docs/html/search/all_f.js | 6 +- docs/html/search/classes_0.js | 42 +- docs/html/search/defines_0.js | 2 +- docs/html/search/defines_1.js | 14 +- docs/html/search/enums_0.js | 12 +- docs/html/search/enumvalues_0.js | 82 +- docs/html/search/files_0.js | 2 +- docs/html/search/functions_0.js | 104 +- docs/html/search/pages_0.js | 2 +- docs/html/search/pages_1.js | 6 +- docs/html/search/pages_2.js | 6 +- docs/html/search/pages_3.js | 2 +- docs/html/search/pages_4.js | 2 +- docs/html/search/pages_5.js | 2 +- docs/html/search/pages_6.js | 2 +- docs/html/search/pages_7.js | 2 +- docs/html/search/pages_8.js | 5 +- docs/html/search/pages_9.js | 4 +- docs/html/search/pages_a.js | 6 +- docs/html/search/typedefs_0.js | 4 +- docs/html/search/typedefs_1.js | 56 +- docs/html/search/variables_0.js | 14 +- docs/html/search/variables_1.js | 12 +- docs/html/search/variables_2.js | 2 +- docs/html/search/variables_3.js | 6 +- docs/html/search/variables_4.js | 4 +- docs/html/search/variables_5.js | 2 +- docs/html/search/variables_6.js | 28 +- docs/html/search/variables_7.js | 2 +- docs/html/search/variables_8.js | 38 +- docs/html/search/variables_9.js | 2 +- docs/html/search/variables_a.js | 2 +- docs/html/search/variables_b.js | 2 +- docs/html/search/variables_c.js | 16 +- docs/html/search/variables_d.js | 36 +- docs/html/vk__mem__alloc_8h.html | 4 +- docs/html/vk__mem__alloc_8h_source.html | 31412 +++++++++---------- docs/html/vk_khr_dedicated_allocation.html | 4 +- src/Tests.cpp | 82 + src/vk_mem_alloc.h | 114 +- 55 files changed, 16556 insertions(+), 16197 deletions(-) create mode 100644 docs/gfx/Aliasing.png create mode 100644 docs/html/resource_aliasing.html diff --git a/README.md b/README.md index 31928c3..3c778a2 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Additional features: - Customization: Predefine appropriate macros to provide your own implementation of all external facilities used by the library, from assert, mutex, and atomic, to vector and linked list. - Support for memory mapping, reference-counted internally. Support for persistently mapped memory: Just allocate with appropriate flag and you get access to mapped pointer. - Support for non-coherent memory. Functions that flush/invalidate memory. `nonCoherentAtomSize` is respected automatically. +- Support for resource aliasing (overlap). - Support for sparse binding and sparse residency: Convenience functions that allocate or free multiple memory pages at once. - Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size) and allocate memory out of it. - Linear allocator: Create a pool with linear algorithm and use it for much faster allocations and deallocations in free-at-once, stack, double stack, or ring buffer fashion. diff --git a/docs/gfx/Aliasing.png b/docs/gfx/Aliasing.png new file mode 100644 index 0000000000000000000000000000000000000000..5f37edb9ed67bd2b628edfc9134c4eba4a9ba89e GIT binary patch literal 6208 zcmdUzXH*nVm&SVr1d%Kt2#g>gIY}PkC`e9{bC5Vg&S`)_BuEYdk_07*L_wlR5G4&6 zg+DN45Xm_Y!_K>B_tWma-}gg3)u&H)ow{|a`uFsGt*fm%m4}x7CB7r^R5kSh05ZCNH4w~eKNf%UzV9;=Uwscp-vC>02OuCIKoIWk;$vs) z=^*Ig?UcJK%LoAULuyJ-3kX})HCX=zaSD1Rg``(iMleIfe^4IP~WnA*@WE;cr>P*AkAv^1LI(W9z*e;9eH zcG>mT`+=m0+VngOK~&WIZSpzd#Ga47QpJVw^n2e+G~C32 zunII*US3{R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OlWtV+Lfm;yw@stSndYOl%T(g;?L2lE zP(R)}do#X7ZAwSOI>#a6&B(@H#seWr9Xh!CHr61XB<0`98OTUa*OL$_tvjc#A^L_Q pVmp?kHtqZO3H2D5lK=6|Ee-xTb!VbneDxntd#0^a{nX~=e*lVPveN(n literal 0 HcmV?d00001 diff --git a/docs/html/allocation_annotation.html b/docs/html/allocation_annotation.html index ee85a63..b111945 100644 --- a/docs/html/allocation_annotation.html +++ b/docs/html/allocation_annotation.html @@ -116,18 +116,18 @@ Allocation names
Note
Passing string name to VMA allocation doesn't automatically set it to the Vulkan buffer or image created with it. You must do it manually using an extension like VK_EXT_debug_utils, which is independent of this library.
-
@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT
Definition: vk_mem_alloc.h:2681
-
void * pUserData
Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...
Definition: vk_mem_alloc.h:2775
+
@ VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT
Definition: vk_mem_alloc.h:2791
+
void * pUserData
Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...
Definition: vk_mem_alloc.h:2885
void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)
Returns current information about specified allocation and atomically marks it as used in current fra...
Represents single memory allocation.
-
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:2578
+
@ VMA_MEMORY_USAGE_GPU_ONLY
Definition: vk_mem_alloc.h:2688
VkResult vmaCreateImage(VmaAllocator allocator, const VkImageCreateInfo *pImageCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkImage *pImage, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
Function similar to vmaCreateBuffer().
-
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:2744
-
void * pUserData
Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...
Definition: vk_mem_alloc.h:3117
+
VmaMemoryUsage usage
Intended usage of memory.
Definition: vk_mem_alloc.h:2854
+
void * pUserData
Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...
Definition: vk_mem_alloc.h:3227
VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)
-
VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:2738
-
Definition: vk_mem_alloc.h:2736
-
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:3073
+
VmaAllocationCreateFlags flags
Use VmaAllocationCreateFlagBits enum.
Definition: vk_mem_alloc.h:2848
+
Definition: vk_mem_alloc.h:2846
+
Parameters of VmaAllocation objects, that can be retrieved using function vmaGetAllocationInfo().
Definition: vk_mem_alloc.h:3183