mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
synced 2024-11-29 09:54:35 +00:00
Fixes in calls to VMA_DEBUG_LOG_FORMAT, using PRIu32 for compatibility
See #400, thanks @dneto0 and @alecazam
This commit is contained in:
parent
01ccf06e4c
commit
7924e27f81
@ -3038,7 +3038,7 @@ static void vma_aligned_free(void* VMA_NULLABLE ptr)
|
|||||||
#if VMA_STATS_STRING_ENABLED
|
#if VMA_STATS_STRING_ENABLED
|
||||||
static inline void VmaUint32ToStr(char* VMA_NOT_NULL outStr, size_t strLen, uint32_t num)
|
static inline void VmaUint32ToStr(char* VMA_NOT_NULL outStr, size_t strLen, uint32_t num)
|
||||||
{
|
{
|
||||||
snprintf(outStr, strLen, "%u", static_cast<unsigned int>(num));
|
snprintf(outStr, strLen, "%" PRIu32, num);
|
||||||
}
|
}
|
||||||
static inline void VmaUint64ToStr(char* VMA_NOT_NULL outStr, size_t strLen, uint64_t num)
|
static inline void VmaUint64ToStr(char* VMA_NOT_NULL outStr, size_t strLen, uint64_t num)
|
||||||
{
|
{
|
||||||
@ -6510,14 +6510,14 @@ void VmaBlockMetadata::DebugLogAllocation(VkDeviceSize offset, VkDeviceSize size
|
|||||||
const char* name = allocation->GetName();
|
const char* name = allocation->GetName();
|
||||||
|
|
||||||
#if VMA_STATS_STRING_ENABLED
|
#if VMA_STATS_STRING_ENABLED
|
||||||
VMA_LEAK_LOG_FORMAT("UNFREED ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p; Name: %s; Type: %s; Usage: %u",
|
VMA_LEAK_LOG_FORMAT("UNFREED ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p; Name: %s; Type: %s; Usage: %" PRIu32,
|
||||||
offset, size, userData, name ? name : "vma_empty",
|
offset, size, userData, name ? name : "vma_empty",
|
||||||
VMA_SUBALLOCATION_TYPE_NAMES[allocation->GetSuballocationType()],
|
VMA_SUBALLOCATION_TYPE_NAMES[allocation->GetSuballocationType()],
|
||||||
allocation->GetBufferImageUsage());
|
allocation->GetBufferImageUsage());
|
||||||
#else
|
#else
|
||||||
VMA_LEAK_LOG_FORMAT("UNFREED ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p; Name: %s; Type: %u",
|
VMA_LEAK_LOG_FORMAT("UNFREED ALLOCATION; Offset: %" PRIu64 "; Size: %" PRIu64 "; UserData: %p; Name: %s; Type: %u",
|
||||||
offset, size, userData, name ? name : "vma_empty",
|
offset, size, userData, name ? name : "vma_empty",
|
||||||
(uint32_t)allocation->GetSuballocationType());
|
(unsigned)allocation->GetSuballocationType());
|
||||||
#endif // VMA_STATS_STRING_ENABLED
|
#endif // VMA_STATS_STRING_ENABLED
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11082,7 +11082,7 @@ VkResult VmaBlockVector::AllocatePage(
|
|||||||
pCurrBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
pCurrBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
||||||
if (res == VK_SUCCESS)
|
if (res == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
VMA_DEBUG_LOG_FORMAT(" Returned from last block #%u", pCurrBlock->GetId());
|
VMA_DEBUG_LOG_FORMAT(" Returned from last block #%" PRIu32, pCurrBlock->GetId());
|
||||||
IncrementallySortBlocks();
|
IncrementallySortBlocks();
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -11118,7 +11118,7 @@ VkResult VmaBlockVector::AllocatePage(
|
|||||||
pCurrBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
pCurrBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
||||||
if (res == VK_SUCCESS)
|
if (res == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
VMA_DEBUG_LOG_FORMAT(" Returned from existing block #%u", pCurrBlock->GetId());
|
VMA_DEBUG_LOG_FORMAT(" Returned from existing block #%" PRIu32, pCurrBlock->GetId());
|
||||||
IncrementallySortBlocks();
|
IncrementallySortBlocks();
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -11137,7 +11137,7 @@ VkResult VmaBlockVector::AllocatePage(
|
|||||||
pCurrBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
pCurrBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
||||||
if (res == VK_SUCCESS)
|
if (res == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
VMA_DEBUG_LOG_FORMAT(" Returned from existing block #%u", pCurrBlock->GetId());
|
VMA_DEBUG_LOG_FORMAT(" Returned from existing block #%" PRIu32, pCurrBlock->GetId());
|
||||||
IncrementallySortBlocks();
|
IncrementallySortBlocks();
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -11154,7 +11154,7 @@ VkResult VmaBlockVector::AllocatePage(
|
|||||||
VkResult res = AllocateFromBlock(pCurrBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
VkResult res = AllocateFromBlock(pCurrBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
||||||
if (res == VK_SUCCESS)
|
if (res == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
VMA_DEBUG_LOG_FORMAT(" Returned from existing block #%u", pCurrBlock->GetId());
|
VMA_DEBUG_LOG_FORMAT(" Returned from existing block #%" PRIu32, pCurrBlock->GetId());
|
||||||
IncrementallySortBlocks();
|
IncrementallySortBlocks();
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -11221,7 +11221,7 @@ VkResult VmaBlockVector::AllocatePage(
|
|||||||
pBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
pBlock, size, alignment, createInfo.flags, createInfo.pUserData, suballocType, strategy, pAllocation);
|
||||||
if (res == VK_SUCCESS)
|
if (res == VK_SUCCESS)
|
||||||
{
|
{
|
||||||
VMA_DEBUG_LOG_FORMAT(" Created new block #%u Size=%" PRIu64, pBlock->GetId(), newBlockSize);
|
VMA_DEBUG_LOG_FORMAT(" Created new block #%" PRIu32 " Size=%" PRIu64, pBlock->GetId(), newBlockSize);
|
||||||
IncrementallySortBlocks();
|
IncrementallySortBlocks();
|
||||||
return VK_SUCCESS;
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -11270,7 +11270,7 @@ void VmaBlockVector::Free(const VmaAllocation hAllocation)
|
|||||||
pBlock->PostFree(m_hAllocator);
|
pBlock->PostFree(m_hAllocator);
|
||||||
VMA_HEAVY_ASSERT(pBlock->Validate());
|
VMA_HEAVY_ASSERT(pBlock->Validate());
|
||||||
|
|
||||||
VMA_DEBUG_LOG_FORMAT(" Freed from MemoryTypeIndex=%u", m_MemoryTypeIndex);
|
VMA_DEBUG_LOG_FORMAT(" Freed from MemoryTypeIndex=%" PRIu32, m_MemoryTypeIndex);
|
||||||
|
|
||||||
const bool canDeleteBlock = m_Blocks.size() > m_MinBlockCount;
|
const bool canDeleteBlock = m_Blocks.size() > m_MinBlockCount;
|
||||||
// pBlock became empty after this deallocation.
|
// pBlock became empty after this deallocation.
|
||||||
@ -11303,7 +11303,7 @@ void VmaBlockVector::Free(const VmaAllocation hAllocation)
|
|||||||
// lock, for performance reason.
|
// lock, for performance reason.
|
||||||
if (pBlockToDelete != VMA_NULL)
|
if (pBlockToDelete != VMA_NULL)
|
||||||
{
|
{
|
||||||
VMA_DEBUG_LOG_FORMAT(" Deleted empty block #%u", pBlockToDelete->GetId());
|
VMA_DEBUG_LOG_FORMAT(" Deleted empty block #%" PRIu32, pBlockToDelete->GetId());
|
||||||
pBlockToDelete->Destroy(m_hAllocator);
|
pBlockToDelete->Destroy(m_hAllocator);
|
||||||
vma_delete(m_hAllocator, pBlockToDelete);
|
vma_delete(m_hAllocator, pBlockToDelete);
|
||||||
}
|
}
|
||||||
@ -13102,7 +13102,7 @@ VkResult VmaAllocator_T::AllocateMemoryOfType(
|
|||||||
VmaAllocation* pAllocations)
|
VmaAllocation* pAllocations)
|
||||||
{
|
{
|
||||||
VMA_ASSERT(pAllocations != VMA_NULL);
|
VMA_ASSERT(pAllocations != VMA_NULL);
|
||||||
VMA_DEBUG_LOG_FORMAT(" AllocateMemory: MemoryTypeIndex=%u, AllocationCount=%zu, Size=%" PRIu64, memTypeIndex, allocationCount, size);
|
VMA_DEBUG_LOG_FORMAT(" AllocateMemory: MemoryTypeIndex=%" PRIu32 ", AllocationCount=%zu, Size=%" PRIu64, memTypeIndex, allocationCount, size);
|
||||||
|
|
||||||
VmaAllocationCreateInfo finalCreateInfo = createInfo;
|
VmaAllocationCreateInfo finalCreateInfo = createInfo;
|
||||||
VkResult res = CalcMemTypeParams(
|
VkResult res = CalcMemTypeParams(
|
||||||
@ -13348,7 +13348,7 @@ VkResult VmaAllocator_T::AllocateDedicatedMemory(
|
|||||||
{
|
{
|
||||||
dedicatedAllocations.Register(pAllocations[allocIndex]);
|
dedicatedAllocations.Register(pAllocations[allocIndex]);
|
||||||
}
|
}
|
||||||
VMA_DEBUG_LOG_FORMAT(" Allocated DedicatedMemory Count=%zu, MemoryTypeIndex=#%u", allocationCount, memTypeIndex);
|
VMA_DEBUG_LOG_FORMAT(" Allocated DedicatedMemory Count=%zu, MemoryTypeIndex=#%" PRIu32, allocationCount, memTypeIndex);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -13925,7 +13925,7 @@ void VmaAllocator_T::GetAllocationInfo2(VmaAllocation hAllocation, VmaAllocation
|
|||||||
|
|
||||||
VkResult VmaAllocator_T::CreatePool(const VmaPoolCreateInfo* pCreateInfo, VmaPool* pPool)
|
VkResult VmaAllocator_T::CreatePool(const VmaPoolCreateInfo* pCreateInfo, VmaPool* pPool)
|
||||||
{
|
{
|
||||||
VMA_DEBUG_LOG_FORMAT(" CreatePool: MemoryTypeIndex=%u, flags=%u", pCreateInfo->memoryTypeIndex, pCreateInfo->flags);
|
VMA_DEBUG_LOG_FORMAT(" CreatePool: MemoryTypeIndex=%" PRIu32 ", flags=%" PRIu32, pCreateInfo->memoryTypeIndex, pCreateInfo->flags);
|
||||||
|
|
||||||
VmaPoolCreateInfo newCreateInfo = *pCreateInfo;
|
VmaPoolCreateInfo newCreateInfo = *pCreateInfo;
|
||||||
|
|
||||||
@ -14442,7 +14442,7 @@ void VmaAllocator_T::FreeDedicatedMemory(const VmaAllocation allocation)
|
|||||||
m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(allocation->GetMemoryTypeIndex()), allocation->GetSize());
|
m_Budget.RemoveAllocation(MemoryTypeIndexToHeapIndex(allocation->GetMemoryTypeIndex()), allocation->GetSize());
|
||||||
m_AllocationObjectAllocator.Free(allocation);
|
m_AllocationObjectAllocator.Free(allocation);
|
||||||
|
|
||||||
VMA_DEBUG_LOG_FORMAT(" Freed DedicatedMemory MemoryTypeIndex=%u", memTypeIndex);
|
VMA_DEBUG_LOG_FORMAT(" Freed DedicatedMemory MemoryTypeIndex=%" PRIu32, memTypeIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t VmaAllocator_T::CalculateGpuDefragmentationMemoryTypeBits() const
|
uint32_t VmaAllocator_T::CalculateGpuDefragmentationMemoryTypeBits() const
|
||||||
|
Loading…
Reference in New Issue
Block a user