mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-22 07:04:34 +00:00
Fix assert when VMA_DEBUG_INITIALIZE_ALLOCATIONS is used with new memory usage flags
Only mappable allocations are filled with bit pattern. See #260
This commit is contained in:
parent
7de5cc00de
commit
5ab8c1752a
@ -76,9 +76,9 @@ Memory initialization</h1>
|
||||
<div class="fragment"><div class="line"><span class="preprocessor">#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1</span></div>
|
||||
<div class="line"><span class="preprocessor">#include "<a class="code" href="vk__mem__alloc_8h.html">vk_mem_alloc.h</a>"</span></div>
|
||||
<div class="ttc" id="avk__mem__alloc_8h_html"><div class="ttname"><a href="vk__mem__alloc_8h.html">vk_mem_alloc.h</a></div></div>
|
||||
</div><!-- fragment --><p >It makes memory of all new allocations initialized to bit pattern <code>0xDCDCDCDC</code>. Before an allocation is destroyed, its memory is filled with bit pattern <code>0xEFEFEFEF</code>. Memory is automatically mapped and unmapped if necessary.</p>
|
||||
</div><!-- fragment --><p >It makes memory of new allocations initialized to bit pattern <code>0xDCDCDCDC</code>. Before an allocation is destroyed, its memory is filled with bit pattern <code>0xEFEFEFEF</code>. Memory is automatically mapped and unmapped if necessary.</p>
|
||||
<p >If you find these values while debugging your program, good chances are that you incorrectly read Vulkan memory that is allocated but not initialized, or already freed, respectively.</p>
|
||||
<p >Memory initialization works only with memory types that are <code>HOST_VISIBLE</code>. It works also with dedicated allocations.</p>
|
||||
<p >Memory initialization works only with memory types that are <code>HOST_VISIBLE</code> and with allocations that can be mapped. It works also with dedicated allocations.</p>
|
||||
<h1><a class="anchor" id="debugging_memory_usage_margins"></a>
|
||||
Margins</h1>
|
||||
<p >By default, allocations are laid out in memory blocks next to each other if possible (considering required alignment, <code>bufferImageGranularity</code>, and <code>nonCoherentAtomSize</code>).</p>
|
||||
|
@ -15906,6 +15906,7 @@ void VmaAllocator_T::UpdateVulkanBudget()
|
||||
void VmaAllocator_T::FillAllocation(const VmaAllocation hAllocation, uint8_t pattern)
|
||||
{
|
||||
if(VMA_DEBUG_INITIALIZE_ALLOCATIONS &&
|
||||
hAllocation->IsMappingAllowed() &&
|
||||
(m_MemProps.memoryTypes[hAllocation->GetMemoryTypeIndex()].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) != 0)
|
||||
{
|
||||
void* pData = VMA_NULL;
|
||||
@ -18823,14 +18824,14 @@ To do it, define macro `VMA_DEBUG_INITIALIZE_ALLOCATIONS` to 1.
|
||||
#include "vk_mem_alloc.h"
|
||||
\endcode
|
||||
|
||||
It makes memory of all new allocations initialized to bit pattern `0xDCDCDCDC`.
|
||||
It makes memory of new allocations initialized to bit pattern `0xDCDCDCDC`.
|
||||
Before an allocation is destroyed, its memory is filled with bit pattern `0xEFEFEFEF`.
|
||||
Memory is automatically mapped and unmapped if necessary.
|
||||
|
||||
If you find these values while debugging your program, good chances are that you incorrectly
|
||||
read Vulkan memory that is allocated but not initialized, or already freed, respectively.
|
||||
|
||||
Memory initialization works only with memory types that are `HOST_VISIBLE`.
|
||||
Memory initialization works only with memory types that are `HOST_VISIBLE` and with allocations that can be mapped.
|
||||
It works also with dedicated allocations.
|
||||
|
||||
\section debugging_memory_usage_margins Margins
|
||||
|
Loading…
Reference in New Issue
Block a user