mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
synced 2024-11-05 12:20:07 +00:00
Fixed vmaVirtualFree legal to call with allocation == VK_NULL_HANDLE
Hopefully fixes #230 Fixes in internal validation. Rebuilt the docs.
This commit is contained in:
parent
22485a05f9
commit
fd4ee1d5aa
@ -610,7 +610,7 @@ Functions</h2></td></tr>
|
|||||||
</div><div class="memdoc">
|
</div><div class="memdoc">
|
||||||
|
|
||||||
<p>Allocates new virtual allocation inside given <a class="el" href="struct_vma_virtual_block.html" title="Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...">VmaVirtualBlock</a>. </p>
|
<p>Allocates new virtual allocation inside given <a class="el" href="struct_vma_virtual_block.html" title="Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...">VmaVirtualBlock</a>. </p>
|
||||||
<p >If the allocation fails due to not enough free space available, <code>VK_ERROR_OUT_OF_DEVICE_MEMORY</code> is returned (despite the function doesn't ever allocate actual GPU memory). <code>pAllocation</code> is then set to <code>VK_NULL_HANDLE</code> AND <code>pOffset</code>, if not null, it set to <code>UINT64_MAX</code>.</p>
|
<p >If the allocation fails due to not enough free space available, <code>VK_ERROR_OUT_OF_DEVICE_MEMORY</code> is returned (despite the function doesn't ever allocate actual GPU memory). <code>pAllocation</code> is then set to <code>VK_NULL_HANDLE</code> and <code>pOffset</code>, if not null, it set to <code>UINT64_MAX</code>.</p>
|
||||||
<dl class="params"><dt>Parameters</dt><dd>
|
<dl class="params"><dt>Parameters</dt><dd>
|
||||||
<table class="params">
|
<table class="params">
|
||||||
<tr><td class="paramdir"></td><td class="paramname">virtualBlock</td><td>Virtual block </td></tr>
|
<tr><td class="paramdir"></td><td class="paramname">virtualBlock</td><td>Virtual block </td></tr>
|
||||||
@ -650,6 +650,7 @@ Functions</h2></td></tr>
|
|||||||
</div><div class="memdoc">
|
</div><div class="memdoc">
|
||||||
|
|
||||||
<p>Frees virtual allocation inside given <a class="el" href="struct_vma_virtual_block.html" title="Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...">VmaVirtualBlock</a>. </p>
|
<p>Frees virtual allocation inside given <a class="el" href="struct_vma_virtual_block.html" title="Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...">VmaVirtualBlock</a>. </p>
|
||||||
|
<p >It is correct to call this function with <code>allocation == VK_NULL_HANDLE</code> - it does nothing. </p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,6 +73,7 @@ $(function() {
|
|||||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||||
<div class="textblock"><p >Represents single memory allocation done inside <a class="el" href="struct_vma_virtual_block.html" title="Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...">VmaVirtualBlock</a>. </p>
|
<div class="textblock"><p >Represents single memory allocation done inside <a class="el" href="struct_vma_virtual_block.html" title="Handle to a virtual block object that allows to use core allocation algorithm without allocating any ...">VmaVirtualBlock</a>. </p>
|
||||||
<p >Use it as a unique identifier to virtual allocation within the single block.</p>
|
<p >Use it as a unique identifier to virtual allocation within the single block.</p>
|
||||||
|
<p >Use value <code>VK_NULL_HANDLE</code> to represent a null/invalid allocation. </p>
|
||||||
</div><hr/>The documentation for this struct was generated from the following file:<ul>
|
</div><hr/>The documentation for this struct was generated from the following file:<ul>
|
||||||
<li>D:/PROJECTS/Vulkan Memory Allocator/REPO/include/<a class="el" href="vk__mem__alloc_8h.html">vk_mem_alloc.h</a></li>
|
<li>D:/PROJECTS/Vulkan Memory Allocator/REPO/include/<a class="el" href="vk__mem__alloc_8h.html">vk_mem_alloc.h</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -833,6 +833,8 @@ VK_DEFINE_HANDLE(VmaDefragmentationContext)
|
|||||||
\brief Represents single memory allocation done inside VmaVirtualBlock.
|
\brief Represents single memory allocation done inside VmaVirtualBlock.
|
||||||
|
|
||||||
Use it as a unique identifier to virtual allocation within the single block.
|
Use it as a unique identifier to virtual allocation within the single block.
|
||||||
|
|
||||||
|
Use value `VK_NULL_HANDLE` to represent a null/invalid allocation.
|
||||||
*/
|
*/
|
||||||
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VmaVirtualAllocation);
|
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VmaVirtualAllocation);
|
||||||
|
|
||||||
@ -2382,6 +2384,8 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaVirtualAllocate(
|
|||||||
VkDeviceSize* VMA_NULLABLE pOffset);
|
VkDeviceSize* VMA_NULLABLE pOffset);
|
||||||
|
|
||||||
/** \brief Frees virtual allocation inside given #VmaVirtualBlock.
|
/** \brief Frees virtual allocation inside given #VmaVirtualBlock.
|
||||||
|
|
||||||
|
It is correct to call this function with `allocation == VK_NULL_HANDLE` - it does nothing.
|
||||||
*/
|
*/
|
||||||
VMA_CALL_PRE void VMA_CALL_POST vmaVirtualFree(
|
VMA_CALL_PRE void VMA_CALL_POST vmaVirtualFree(
|
||||||
VmaVirtualBlock VMA_NOT_NULL virtualBlock,
|
VmaVirtualBlock VMA_NOT_NULL virtualBlock,
|
||||||
@ -6572,7 +6576,7 @@ bool VmaBlockMetadata_Generic::Validate() const
|
|||||||
{
|
{
|
||||||
if (!IsVirtual())
|
if (!IsVirtual())
|
||||||
{
|
{
|
||||||
VMA_VALIDATE((VkDeviceSize)alloc->GetAllocHandle() == subAlloc.offset);
|
VMA_VALIDATE((VkDeviceSize)alloc->GetAllocHandle() == subAlloc.offset + 1);
|
||||||
VMA_VALIDATE(alloc->GetSize() == subAlloc.size);
|
VMA_VALIDATE(alloc->GetSize() == subAlloc.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7435,7 +7439,7 @@ bool VmaBlockMetadata_Linear::Validate() const
|
|||||||
{
|
{
|
||||||
if (!IsVirtual())
|
if (!IsVirtual())
|
||||||
{
|
{
|
||||||
VMA_VALIDATE((VkDeviceSize)alloc->GetAllocHandle() == suballoc.offset);
|
VMA_VALIDATE((VkDeviceSize)alloc->GetAllocHandle() == suballoc.offset + 1);
|
||||||
VMA_VALIDATE(alloc->GetSize() == suballoc.size);
|
VMA_VALIDATE(alloc->GetSize() == suballoc.size);
|
||||||
}
|
}
|
||||||
sumUsedSize += suballoc.size;
|
sumUsedSize += suballoc.size;
|
||||||
@ -7477,7 +7481,7 @@ bool VmaBlockMetadata_Linear::Validate() const
|
|||||||
{
|
{
|
||||||
if (!IsVirtual())
|
if (!IsVirtual())
|
||||||
{
|
{
|
||||||
VMA_VALIDATE((VkDeviceSize)alloc->GetAllocHandle() == suballoc.offset);
|
VMA_VALIDATE((VkDeviceSize)alloc->GetAllocHandle() == suballoc.offset + 1);
|
||||||
VMA_VALIDATE(alloc->GetSize() == suballoc.size);
|
VMA_VALIDATE(alloc->GetSize() == suballoc.size);
|
||||||
}
|
}
|
||||||
sumUsedSize += suballoc.size;
|
sumUsedSize += suballoc.size;
|
||||||
@ -7511,7 +7515,7 @@ bool VmaBlockMetadata_Linear::Validate() const
|
|||||||
{
|
{
|
||||||
if (!IsVirtual())
|
if (!IsVirtual())
|
||||||
{
|
{
|
||||||
VMA_VALIDATE((VkDeviceSize)alloc->GetAllocHandle() == suballoc.offset);
|
VMA_VALIDATE((VkDeviceSize)alloc->GetAllocHandle() == suballoc.offset + 1);
|
||||||
VMA_VALIDATE(alloc->GetSize() == suballoc.size);
|
VMA_VALIDATE(alloc->GetSize() == suballoc.size);
|
||||||
}
|
}
|
||||||
sumUsedSize += suballoc.size;
|
sumUsedSize += suballoc.size;
|
||||||
@ -17847,7 +17851,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaVirtualAllocate(VmaVirtualBlock VMA_NOT_N
|
|||||||
|
|
||||||
VMA_CALL_PRE void VMA_CALL_POST vmaVirtualFree(VmaVirtualBlock VMA_NOT_NULL virtualBlock, VmaVirtualAllocation allocation)
|
VMA_CALL_PRE void VMA_CALL_POST vmaVirtualFree(VmaVirtualBlock VMA_NOT_NULL virtualBlock, VmaVirtualAllocation allocation)
|
||||||
{
|
{
|
||||||
if(virtualBlock != VMA_NULL)
|
if(allocation != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
VMA_ASSERT(virtualBlock != VK_NULL_HANDLE);
|
VMA_ASSERT(virtualBlock != VK_NULL_HANDLE);
|
||||||
VMA_DEBUG_LOG("vmaVirtualFree");
|
VMA_DEBUG_LOG("vmaVirtualFree");
|
||||||
|
@ -2799,6 +2799,9 @@ static void TestVirtualBlocks()
|
|||||||
|
|
||||||
vmaVirtualFree(block, allocation0);
|
vmaVirtualFree(block, allocation0);
|
||||||
|
|
||||||
|
// # Test free of null allocation.
|
||||||
|
vmaVirtualFree(block, VK_NULL_HANDLE);
|
||||||
|
|
||||||
// # Test alignment
|
// # Test alignment
|
||||||
|
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user