Improved documentation of VmaMemoryUsage.

This commit is contained in:
Adam Sawicki 2018-02-12 15:12:32 +01:00
parent e5ae29a5e4
commit 20e500e3d0
3 changed files with 98 additions and 82 deletions

View File

@ -711,17 +711,26 @@ Functions</h2></td></tr>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd"></a>VMA_MEMORY_USAGE_UNKNOWN&#160;</td><td class="fielddoc"><p>No intended memory usage specified. Use other members of <a class="el" href="struct_vma_allocation_create_info.html">VmaAllocationCreateInfo</a> to specify your requirements. </p>
</td></tr>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"></a>VMA_MEMORY_USAGE_GPU_ONLY&#160;</td><td class="fielddoc"><p>Memory will be used on device only, so faster access from the device is preferred. It usually means device-local GPU memory. No need to be mappable on host. Good e.g. for images to be used as attachments, images containing textures to be sampled, buffers used as vertex buffer, index buffer, uniform buffer and majority of other types of resources used by device. You can still do transfers from/to such resource to/from host memory.</p>
<p>The allocation may still end up in <code>HOST_VISIBLE</code> memory on some implementations. In such case, you are free to map it. You can also use <code>VMA_ALLOCATION_CREATE_MAPPED_BIT</code> with this usage type. </p>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7"></a>VMA_MEMORY_USAGE_GPU_ONLY&#160;</td><td class="fielddoc"><p>Memory will be used on device only, so fast access from the device is preferred. It usually means device-local GPU (video) memory. No need to be mappable on host.</p>
<p>Usage:</p>
<ul>
<li>Resources written and read by device, e.g. images used as attachments.</li>
<li>Resources transferred from host once (immutable) or infrequently and read by device multiple times, e.g. textures to be sampled, vertex buffers, uniform (constant) buffers, and majority of other types of resources used by device.</li>
</ul>
<p>Allocation may still end up in <code>HOST_VISIBLE</code> memory on some implementations. In such case, you are free to map it. You can use <code>VMA_ALLOCATION_CREATE_MAPPED_BIT</code> with this usage type. </p>
</td></tr>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"></a>VMA_MEMORY_USAGE_CPU_ONLY&#160;</td><td class="fielddoc"><p>Memory will be mapped and used on host. It usually means CPU system memory. Could be used for transfer to/from device. Good e.g. for "staging" copy of buffers and images, used as transfer source or destination. Resources created in this pool may still be accessible to the device, but access to them can be slower.</p>
<p>Guarantees to be <code>HOST_VISIBLE</code> and <code>HOST_COHERENT</code>. </p>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5"></a>VMA_MEMORY_USAGE_CPU_ONLY&#160;</td><td class="fielddoc"><p>Memory will be mappable on host. It usually means CPU (system) memory. Resources created in this pool are still accessible to the device, but access to them can be slower. Guarantees to be <code>HOST_VISIBLE</code> and <code>HOST_COHERENT</code>. CPU read may be uncached.</p>
<p>Usage: Staging copy of resources used as transfer source. </p>
</td></tr>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67"></a>VMA_MEMORY_USAGE_CPU_TO_GPU&#160;</td><td class="fielddoc"><p>Memory will be used for frequent (dynamic) updates from host and reads on device (upload). Good e.g. for vertex buffers or uniform buffers updated every frame.</p>
<p>Guarantees to be <code>HOST_VISIBLE</code>. </p>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67"></a>VMA_MEMORY_USAGE_CPU_TO_GPU&#160;</td><td class="fielddoc"><p>Memory that is both mappable on host (guarantees to be <code>HOST_VISIBLE</code>) and preferably fast to access by GPU. CPU reads may be uncached and very slow.</p>
<p>Usage: Resources written frequently by host (dynamic), read by device. E.g. textures, vertex buffers, uniform buffers updated every frame or every draw call. </p>
</td></tr>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27"></a>VMA_MEMORY_USAGE_GPU_TO_CPU&#160;</td><td class="fielddoc"><p>Memory will be used for frequent writing on device and readback on host (download).</p>
<p>Guarantees to be <code>HOST_VISIBLE</code>. </p>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27"></a>VMA_MEMORY_USAGE_GPU_TO_CPU&#160;</td><td class="fielddoc"><p>Memory mappable on host (guarantees to be <code>HOST_VISIBLE</code>) and cached.</p>
<p>Usage:</p>
<ul>
<li>Resources written by device, read by host - results of some computations, e.g. screen capture, average scene luminance for HDR tone mapping.</li>
<li>Any resources read on host, e.g. CPU-side copy of vertex buffer used as source of transfer, but also used for collision detection. </li>
</ul>
</td></tr>
<tr><td class="fieldname"><a id="aa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e"></a>VMA_MEMORY_USAGE_MAX_ENUM&#160;</td><td class="fielddoc"></td></tr>
</table>

File diff suppressed because one or more lines are too long

View File

@ -950,37 +950,44 @@ typedef enum VmaMemoryUsage
Use other members of VmaAllocationCreateInfo to specify your requirements.
*/
VMA_MEMORY_USAGE_UNKNOWN = 0,
/** Memory will be used on device only, so faster access from the device is preferred.
It usually means device-local GPU memory.
/** Memory will be used on device only, so fast access from the device is preferred.
It usually means device-local GPU (video) memory.
No need to be mappable on host.
Good e.g. for images to be used as attachments, images containing textures to be sampled,
buffers used as vertex buffer, index buffer, uniform buffer and majority of
other types of resources used by device.
You can still do transfers from/to such resource to/from host memory.
The allocation may still end up in `HOST_VISIBLE` memory on some implementations.
Usage:
- Resources written and read by device, e.g. images used as attachments.
- Resources transferred from host once (immutable) or infrequently and read by
device multiple times, e.g. textures to be sampled, vertex buffers, uniform
(constant) buffers, and majority of other types of resources used by device.
Allocation may still end up in `HOST_VISIBLE` memory on some implementations.
In such case, you are free to map it.
You can also use `VMA_ALLOCATION_CREATE_MAPPED_BIT` with this usage type.
You can use `VMA_ALLOCATION_CREATE_MAPPED_BIT` with this usage type.
*/
VMA_MEMORY_USAGE_GPU_ONLY = 1,
/** Memory will be mapped and used on host.
It usually means CPU system memory.
Could be used for transfer to/from device.
Good e.g. for "staging" copy of buffers and images, used as transfer source or destination.
Resources created in this pool may still be accessible to the device, but access to them can be slower.
/** Memory will be mappable on host.
It usually means CPU (system) memory.
Resources created in this pool are still accessible to the device, but access to them can be slower.
Guarantees to be `HOST_VISIBLE` and `HOST_COHERENT`.
CPU read may be uncached.
Usage: Staging copy of resources used as transfer source.
*/
VMA_MEMORY_USAGE_CPU_ONLY = 2,
/** Memory will be used for frequent (dynamic) updates from host and reads on device (upload).
Good e.g. for vertex buffers or uniform buffers updated every frame.
/**
Memory that is both mappable on host (guarantees to be `HOST_VISIBLE`) and preferably fast to access by GPU.
CPU reads may be uncached and very slow.
Guarantees to be `HOST_VISIBLE`.
Usage: Resources written frequently by host (dynamic), read by device. E.g. textures, vertex buffers, uniform buffers updated every frame or every draw call.
*/
VMA_MEMORY_USAGE_CPU_TO_GPU = 3,
/** Memory will be used for frequent writing on device and readback on host (download).
/** Memory mappable on host (guarantees to be `HOST_VISIBLE`) and cached.
Guarantees to be `HOST_VISIBLE`.
Usage:
- Resources written by device, read by host - results of some computations, e.g. screen capture, average scene luminance for HDR tone mapping.
- Any resources read on host, e.g. CPU-side copy of vertex buffer used as source of transfer, but also used for collision detection.
*/
VMA_MEMORY_USAGE_GPU_TO_CPU = 4,
VMA_MEMORY_USAGE_MAX_ENUM = 0x7FFFFFFF