Skip to content

Commit 3442720

Browse files
authored
Merge pull request #505 from sawickiap/master
Added vmaAllocateDedicatedMemory, vmaCreateDedicatedBuffer, and other...
2 parents 1076b34 + 6d74249 commit 3442720

File tree

131 files changed

+4258
-4354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+4258
-4354
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Easy to integrate Vulkan memory allocation library.
88

99
**Changelog:** See [CHANGELOG.md](CHANGELOG.md)
1010

11-
**Product page:** [Vulkan Memory Allocator on GPUOpen](https://gpuopen.com/gaming-product/vulkan-memory-allocator/)
11+
**Product page:** [Vulkan Memory Allocator on GPUOpen](https://gpuopen.com/vulkan-memory-allocator/)
1212

1313
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.svg)](http://isitmaintained.com/project/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator "Average time to resolve an issue")
1414

@@ -44,7 +44,7 @@ Additional features:
4444
- Custom memory pools: Create a pool with desired parameters (e.g. fixed or limited maximum size) and allocate memory out of it.
4545
- 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.
4646
- Support for Vulkan 1.0...1.4.
47-
- Support for extensions (and equivalent functionality included in new Vulkan versions):
47+
- Support for extensions (and equivalent functionality included in new core Vulkan versions):
4848
- VK_KHR_dedicated_allocation: Just enable it and it will be used automatically by the library.
4949
- VK_KHR_bind_memory2.
5050
- VK_KHR_maintenance4.
@@ -60,7 +60,7 @@ Additional features:
6060
- JSON dump: Obtain a string in JSON format with detailed map of internal state, including list of allocations, their string names, and gaps between them.
6161
- Convert this JSON dump into a picture to visualize your memory. See [tools/GpuMemDumpVis](tools/GpuMemDumpVis/README.md).
6262
- Debugging incorrect memory usage: Enable initialization of all allocated memory with a bit pattern to detect usage of uninitialized or freed memory. Enable validation of a magic number after every allocation to detect out-of-bounds memory corruption.
63-
- Support for interoperability with OpenGL.
63+
- Support for interoperability with OpenGL, Direct3D, and other graphics APIs through external memory export.
6464
- Virtual allocator: Interface for using core allocation algorithm to allocate any custom data, e.g. pieces of one large buffer.
6565

6666
# Prerequisites

docs/html/allocation_annotation.html

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
55
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
6-
<meta name="generator" content="Doxygen 1.13.0"/>
6+
<meta name="generator" content="Doxygen 1.14.0"/>
77
<meta name="viewport" content="width=device-width, initial-scale=1"/>
88
<title>Vulkan Memory Allocator: Allocation names and user data</title>
99
<link href="tabs.css" rel="stylesheet" type="text/css"/>
1010
<script type="text/javascript" src="jquery.js"></script>
1111
<script type="text/javascript" src="dynsections.js"></script>
1212
<script type="text/javascript" src="clipboard.js"></script>
13-
<link href="navtree.css" rel="stylesheet" type="text/css"/>
14-
<script type="text/javascript" src="resize.js"></script>
1513
<script type="text/javascript" src="cookie.js"></script>
1614
<link href="search/search.css" rel="stylesheet" type="text/css"/>
1715
<script type="text/javascript" src="search/searchdata.js"></script>
@@ -33,33 +31,22 @@
3331
</table>
3432
</div>
3533
<!-- end header part -->
36-
<!-- Generated by Doxygen 1.13.0 -->
34+
<!-- Generated by Doxygen 1.14.0 -->
3735
<script type="text/javascript">
38-
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
3936
var searchBox = new SearchBox("searchBox", "search/",'.html');
40-
/* @license-end */
4137
</script>
4238
<script type="text/javascript">
43-
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
44-
$(function() { codefold.init(0); });
45-
/* @license-end */
39+
$(function() { codefold.init(); });
4640
</script>
4741
<script type="text/javascript" src="menudata.js"></script>
4842
<script type="text/javascript" src="menu.js"></script>
4943
<script type="text/javascript">
50-
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
5144
$(function() {
5245
initMenu('',true,false,'search.php','Search',false);
5346
$(function() { init_search(); });
5447
});
55-
/* @license-end */
5648
</script>
5749
<div id="main-nav"></div>
58-
<script type="text/javascript">
59-
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
60-
$(function(){ initResizable(false); });
61-
/* @license-end */
62-
</script>
6350
<!-- window showing the filter options -->
6451
<div id="MSearchSelectWindow"
6552
onmouseover="return searchBox.OnSearchSelectShow()"
@@ -83,17 +70,17 @@
8370

8471
<div id="nav-path" class="navpath">
8572
<ul>
86-
<li class="navelem"><a class="el" href="index.html">Vulkan Memory Allocator</a></li> </ul>
73+
<li class="navelem"><a href="index.html">Vulkan Memory Allocator</a></li> </ul>
8774
</div>
8875
</div><!-- top -->
8976
<div id="doc-content">
9077
<div><div class="header">
91-
<div class="headertitle"><div class="title">Allocation names and user data</div></div>
78+
<div class="headertitle"><div class="title">Allocation names and user data </div></div>
9279
</div><!--header-->
9380
<div class="contents">
94-
<div class="textblock"><h1><a class="anchor" id="allocation_user_data"></a>
81+
<div class="textblock"><h1 class="doxsection"><a class="anchor" id="allocation_user_data"></a>
9582
Allocation user data</h1>
96-
<p>You can annotate allocations with your own information, e.g. for debugging purposes. To do that, fill <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> field when creating an allocation. It is an opaque <code>void*</code> pointer. You can use it e.g. as a pointer, some handle, index, key, ordinal number or any other value that would associate the allocation with your custom metadata. It is useful to identify appropriate data structures in your engine given <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, e.g. when doing <a class="el" href="defragmentation.html">Defragmentation</a>.</p>
83+
<p>You can annotate allocations with your own information, e.g. for debugging purposes. To do that, fill <a class="el" href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19" title="Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...">VmaAllocationCreateInfo::pUserData</a> field when creating an allocation. It is an opaque <span class="tt">void*</span> pointer. You can use it e.g. as a pointer, some handle, index, key, ordinal number or any other value that would associate the allocation with your custom metadata. It is useful to identify appropriate data structures in your engine given <a class="el" href="struct_vma_allocation.html" title="Represents single memory allocation.">VmaAllocation</a>, e.g. when doing <a class="el" href="defragmentation.html">Defragmentation</a>.</p>
9784
<div class="fragment"><div class="line">VkBufferCreateInfo bufCreateInfo = ...</div>
9885
<div class="line"> </div>
9986
<div class="line">MyBufferMetadata* pMetadata = CreateBufferMetadata();</div>
@@ -106,21 +93,21 @@
10693
<div class="line"><a class="code hl_struct" href="struct_vma_allocation.html">VmaAllocation</a> allocation;</div>
10794
<div class="line"><a class="code hl_function" href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a>(allocator, &amp;bufCreateInfo, &amp;allocCreateInfo, &amp;buffer, &amp;allocation, <span class="keyword">nullptr</span>);</div>
10895
<div class="ttc" id="agroup__group__alloc_html_gac72ee55598617e8eecca384e746bab51"><div class="ttname"><a href="group__group__alloc.html#gac72ee55598617e8eecca384e746bab51">vmaCreateBuffer</a></div><div class="ttdeci">VkResult vmaCreateBuffer(VmaAllocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, const VmaAllocationCreateInfo *pAllocationCreateInfo, VkBuffer *pBuffer, VmaAllocation *pAllocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Creates a new VkBuffer, allocates and binds memory for it.</div></div>
109-
<div class="ttc" id="agroup__group__alloc_html_ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e"><div class="ttname"><a href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e">VMA_MEMORY_USAGE_AUTO</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_AUTO</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:550</div></div>
110-
<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdoc">Parameters of new VmaAllocation.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1291</div></div>
111-
<div class="ttc" id="astruct_vma_allocation_create_info_html_a8259e85c272683434f4abb4ddddffe19"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">VmaAllocationCreateInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1330</div></div>
112-
<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1299</div></div>
96+
<div class="ttc" id="agroup__group__alloc_html_ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e"><div class="ttname"><a href="group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e">VMA_MEMORY_USAGE_AUTO</a></div><div class="ttdeci">@ VMA_MEMORY_USAGE_AUTO</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:551</div></div>
97+
<div class="ttc" id="astruct_vma_allocation_create_info_html"><div class="ttname"><a href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a></div><div class="ttdoc">Parameters of new VmaAllocation.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1292</div></div>
98+
<div class="ttc" id="astruct_vma_allocation_create_info_html_a8259e85c272683434f4abb4ddddffe19"><div class="ttname"><a href="struct_vma_allocation_create_info.html#a8259e85c272683434f4abb4ddddffe19">VmaAllocationCreateInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that will be stored in VmaAllocation, can be read as VmaAllocationInfo...</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1331</div></div>
99+
<div class="ttc" id="astruct_vma_allocation_create_info_html_accb8b06b1f677d858cb9af20705fa910"><div class="ttname"><a href="struct_vma_allocation_create_info.html#accb8b06b1f677d858cb9af20705fa910">VmaAllocationCreateInfo::usage</a></div><div class="ttdeci">VmaMemoryUsage usage</div><div class="ttdoc">Intended usage of memory.</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1300</div></div>
113100
<div class="ttc" id="astruct_vma_allocation_html"><div class="ttname"><a href="struct_vma_allocation.html">VmaAllocation</a></div><div class="ttdoc">Represents single memory allocation.</div></div>
114101
</div><!-- fragment --><p>The pointer may be later retrieved as <a class="el" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13" title="Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...">VmaAllocationInfo::pUserData</a>:</p>
115102
<div class="fragment"><div class="line"><a class="code hl_struct" href="struct_vma_allocation_info.html">VmaAllocationInfo</a> allocInfo;</div>
116103
<div class="line"><a class="code hl_function" href="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a>(allocator, allocation, &amp;allocInfo);</div>
117104
<div class="line">MyBufferMetadata* pMetadata = (MyBufferMetadata*)allocInfo.<a class="code hl_variable" href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">pUserData</a>;</div>
118105
<div class="ttc" id="agroup__group__alloc_html_ga86dd08aba8633bfa4ad0df2e76481d8b"><div class="ttname"><a href="group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b">vmaGetAllocationInfo</a></div><div class="ttdeci">void vmaGetAllocationInfo(VmaAllocator allocator, VmaAllocation allocation, VmaAllocationInfo *pAllocationInfo)</div><div class="ttdoc">Returns current information about specified allocation.</div></div>
119-
<div class="ttc" id="astruct_vma_allocation_info_html"><div class="ttname"><a href="struct_vma_allocation_info.html">VmaAllocationInfo</a></div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1410</div></div>
120-
<div class="ttc" id="astruct_vma_allocation_info_html_adc507656149c04de7ed95d0042ba2a13"><div class="ttname"><a href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">VmaAllocationInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1457</div></div>
106+
<div class="ttc" id="astruct_vma_allocation_info_html"><div class="ttname"><a href="struct_vma_allocation_info.html">VmaAllocationInfo</a></div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1411</div></div>
107+
<div class="ttc" id="astruct_vma_allocation_info_html_adc507656149c04de7ed95d0042ba2a13"><div class="ttname"><a href="struct_vma_allocation_info.html#adc507656149c04de7ed95d0042ba2a13">VmaAllocationInfo::pUserData</a></div><div class="ttdeci">void * pUserData</div><div class="ttdoc">Custom general-purpose pointer that was passed as VmaAllocationCreateInfo::pUserData or set using vma...</div><div class="ttdef"><b>Definition</b> vk_mem_alloc.h:1458</div></div>
121108
</div><!-- fragment --><p>It can also be changed using function <a class="el" href="group__group__alloc.html#gaf9147d31ffc11d62fc187bde283ed14f" title="Sets pUserData in given allocation to new value.">vmaSetAllocationUserData()</a>.</p>
122-
<p>Values of (non-zero) allocations' <code>pUserData</code> are printed in JSON report created by <a class="el" href="group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0" title="Builds and returns statistics as a null-terminated string in JSON format.">vmaBuildStatsString()</a> in hexadecimal form.</p>
123-
<h1><a class="anchor" id="allocation_names"></a>
109+
<p>Values of (non-zero) allocations' <span class="tt">pUserData</span> are printed in JSON report created by <a class="el" href="group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0" title="Builds and returns statistics as a null-terminated string in JSON format.">vmaBuildStatsString()</a> in hexadecimal form.</p>
110+
<h1 class="doxsection"><a class="anchor" id="allocation_names"></a>
124111
Allocation names</h1>
125112
<p>An allocation can also carry a null-terminated string, giving a name to the allocation. To set it, call <a class="el" href="group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc" title="Sets pName in given allocation to new value.">vmaSetAllocationName()</a>. The library creates internal copy of the string, so the pointer you pass doesn't need to be valid for whole lifetime of the allocation. You can free it after the call.</p>
126113
<div class="fragment"><div class="line">std::string imageName = <span class="stringliteral">&quot;Texture: &quot;</span>;</div>
@@ -133,7 +120,7 @@ <h1><a class="anchor" id="allocation_names"></a>
133120
</div><!-- PageDoc -->
134121
<!-- start footer part -->
135122
<hr class="footer"/><address class="footer"><small>
136-
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.0
123+
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0
137124
</small></address>
138125
</div><!-- doc-content -->
139126
</body>

0 commit comments

Comments
 (0)