mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-30 02:04:35 +00:00
Fixed vmaCreateBuffer, vmaCreateImage to always return null as *pBuffer, *pImage, *pAllocation of not succeeded. Fixed that in documentation as well.
This commit is contained in:
parent
e97e9b6637
commit
89f6e44635
Binary file not shown.
@ -132,17 +132,18 @@ Functions</h2></td></tr>
|
|||||||
<table class="params">
|
<table class="params">
|
||||||
<tr><td class="paramdir">[out]</td><td class="paramname">pBuffer</td><td>Buffer that was created. </td></tr>
|
<tr><td class="paramdir">[out]</td><td class="paramname">pBuffer</td><td>Buffer that was created. </td></tr>
|
||||||
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Allocation that was created. </td></tr>
|
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocation</td><td>Allocation that was created. </td></tr>
|
||||||
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocationInfo</td><td>Optional. Information about allocated memory. It can be later fetched using function VmaGetAllocationInfo().</td></tr>
|
<tr><td class="paramdir">[out]</td><td class="paramname">pAllocationInfo</td><td>Optional. Information about allocated memory. It can be later fetched using function <a class="el" href="group__layer2.html#ga86dd08aba8633bfa4ad0df2e76481d8b" title="Returns current information about specified allocation. ">vmaGetAllocationInfo()</a>.</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<p>This function automatically:</p>
|
<p>This function automatically:</p>
|
||||||
<ol type="1">
|
<ol type="1">
|
||||||
<li>Creates buffer/image.</li>
|
<li>Creates buffer.</li>
|
||||||
<li>Allocates appropriate memory for it.</li>
|
<li>Allocates appropriate memory for it.</li>
|
||||||
<li>Binds the buffer/image with the memory.</li>
|
<li>Binds the buffer with the memory.</li>
|
||||||
</ol>
|
</ol>
|
||||||
<p>You do not (and should not) pass returned pMemory to vmaFreeMemory. Only calling <a class="el" href="group__layer3.html#ga0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer()</a> / <a class="el" href="group__layer3.html#gae50d2cb3b4a3bfd4dd40987234e50e7e">vmaDestroyImage()</a> is required for objects created using <a class="el" href="group__layer3.html#ga2f711e32e95cf9bf8dff4917230c2e9b">vmaCreateBuffer()</a> / <a class="el" href="group__layer3.html#ga9e34bc318ff4b25d1958e79b9db3f1aa" title="Function similar to vmaCreateBuffer(). ">vmaCreateImage()</a>. </p>
|
<p>If any of these operations fail, buffer and allocation are not created, returned value is negative error code, *pBuffer and *pAllocation are null.</p>
|
||||||
|
<p>If the function succeeded, you must destroy both buffer and allocation when you no longer need them using either convenience function <a class="el" href="group__layer3.html#ga0d9f4e4ba5bf9aab1f1c746387753d77">vmaDestroyBuffer()</a> or separately, using vkDestroyBuffer() and <a class="el" href="group__layer2.html#ga11f0fbc034fa81a4efedd73d61ce7568" title="Frees memory previously allocated using vmaAllocateMemory(), vmaAllocateMemoryForBuffer(), or vmaAllocateMemoryForImage(). ">vmaFreeMemory()</a>. </p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
File diff suppressed because one or more lines are too long
@ -667,17 +667,20 @@ VkResult vmaDefragment(
|
|||||||
/**
|
/**
|
||||||
@param[out] pBuffer Buffer that was created.
|
@param[out] pBuffer Buffer that was created.
|
||||||
@param[out] pAllocation Allocation that was created.
|
@param[out] pAllocation Allocation that was created.
|
||||||
@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function VmaGetAllocationInfo().
|
@param[out] pAllocationInfo Optional. Information about allocated memory. It can be later fetched using function vmaGetAllocationInfo().
|
||||||
|
|
||||||
This function automatically:
|
This function automatically:
|
||||||
|
|
||||||
-# Creates buffer/image.
|
-# Creates buffer.
|
||||||
-# Allocates appropriate memory for it.
|
-# Allocates appropriate memory for it.
|
||||||
-# Binds the buffer/image with the memory.
|
-# Binds the buffer with the memory.
|
||||||
|
|
||||||
You do not (and should not) pass returned pMemory to vmaFreeMemory. Only calling
|
If any of these operations fail, buffer and allocation are not created,
|
||||||
vmaDestroyBuffer() / vmaDestroyImage() is required for objects created using
|
returned value is negative error code, *pBuffer and *pAllocation are null.
|
||||||
vmaCreateBuffer() / vmaCreateImage().
|
|
||||||
|
If the function succeeded, you must destroy both buffer and allocation when you
|
||||||
|
no longer need them using either convenience function vmaDestroyBuffer() or
|
||||||
|
separately, using vkDestroyBuffer() and vmaFreeMemory().
|
||||||
*/
|
*/
|
||||||
VkResult vmaCreateBuffer(
|
VkResult vmaCreateBuffer(
|
||||||
VmaAllocator allocator,
|
VmaAllocator allocator,
|
||||||
@ -5285,6 +5288,9 @@ VkResult vmaCreateBuffer(
|
|||||||
|
|
||||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||||
|
|
||||||
|
*pBuffer = VK_NULL_HANDLE;
|
||||||
|
*pAllocation = VK_NULL_HANDLE;
|
||||||
|
|
||||||
// 1. Create VkBuffer.
|
// 1. Create VkBuffer.
|
||||||
VkResult res = vkCreateBuffer(allocator->m_hDevice, pCreateInfo, allocator->GetAllocationCallbacks(), pBuffer);
|
VkResult res = vkCreateBuffer(allocator->m_hDevice, pCreateInfo, allocator->GetAllocationCallbacks(), pBuffer);
|
||||||
if(res >= 0)
|
if(res >= 0)
|
||||||
@ -5313,9 +5319,11 @@ VkResult vmaCreateBuffer(
|
|||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
allocator->FreeMemory(*pAllocation);
|
allocator->FreeMemory(*pAllocation);
|
||||||
|
*pAllocation = VK_NULL_HANDLE;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
vkDestroyBuffer(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks());
|
vkDestroyBuffer(allocator->m_hDevice, *pBuffer, allocator->GetAllocationCallbacks());
|
||||||
|
*pBuffer = VK_NULL_HANDLE;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@ -5354,6 +5362,9 @@ VkResult vmaCreateImage(
|
|||||||
|
|
||||||
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
VMA_DEBUG_GLOBAL_MUTEX_LOCK
|
||||||
|
|
||||||
|
*pImage = VK_NULL_HANDLE;
|
||||||
|
*pAllocation = VK_NULL_HANDLE;
|
||||||
|
|
||||||
// 1. Create VkImage.
|
// 1. Create VkImage.
|
||||||
VkResult res = vkCreateImage(allocator->m_hDevice, pCreateInfo, allocator->GetAllocationCallbacks(), pImage);
|
VkResult res = vkCreateImage(allocator->m_hDevice, pCreateInfo, allocator->GetAllocationCallbacks(), pImage);
|
||||||
if(res >= 0)
|
if(res >= 0)
|
||||||
@ -5379,9 +5390,11 @@ VkResult vmaCreateImage(
|
|||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
allocator->FreeMemory(*pAllocation);
|
allocator->FreeMemory(*pAllocation);
|
||||||
|
*pAllocation = VK_NULL_HANDLE;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
vkDestroyImage(allocator->m_hDevice, *pImage, allocator->GetAllocationCallbacks());
|
vkDestroyImage(allocator->m_hDevice, *pImage, allocator->GetAllocationCallbacks());
|
||||||
|
*pImage = VK_NULL_HANDLE;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
Loading…
Reference in New Issue
Block a user