MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / PrintDetailedMap

Method PrintDetailedMap

include/vk_mem_alloc.h:7812–8125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7810
7811#if VMA_STATS_STRING_ENABLED
7812void VmaBlockMetadata_Linear::PrintDetailedMap(class VmaJsonWriter& json) const
7813{
7814 const VkDeviceSize size = GetSize();
7815 const SuballocationVectorType& suballocations1st = AccessSuballocations1st();
7816 const SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
7817 const size_t suballoc1stCount = suballocations1st.size();
7818 const size_t suballoc2ndCount = suballocations2nd.size();
7819
7820 // FIRST PASS
7821
7822 size_t unusedRangeCount = 0;
7823 VkDeviceSize usedBytes = 0;
7824
7825 VkDeviceSize lastOffset = 0;
7826
7827 size_t alloc2ndCount = 0;
7828 if (m_2ndVectorMode == SECOND_VECTOR_RING_BUFFER)
7829 {
7830 const VkDeviceSize freeSpace2ndTo1stEnd = suballocations1st[m_1stNullItemsBeginCount].offset;
7831 size_t nextAlloc2ndIndex = 0;
7832 while (lastOffset < freeSpace2ndTo1stEnd)
7833 {
7834 // Find next non-null allocation or move nextAlloc2ndIndex to the end.
7835 while (nextAlloc2ndIndex < suballoc2ndCount &&
7836 suballocations2nd[nextAlloc2ndIndex].userData == VMA_NULL)
7837 {
7838 ++nextAlloc2ndIndex;
7839 }
7840
7841 // Found non-null allocation.
7842 if (nextAlloc2ndIndex < suballoc2ndCount)
7843 {
7844 const VmaSuballocation& suballoc = suballocations2nd[nextAlloc2ndIndex];
7845
7846 // 1. Process free space before this allocation.
7847 if (lastOffset < suballoc.offset)
7848 {
7849 // There is free space from lastOffset to suballoc.offset.
7850 ++unusedRangeCount;
7851 }
7852
7853 // 2. Process this allocation.
7854 // There is allocation with suballoc.offset, suballoc.size.
7855 ++alloc2ndCount;
7856 usedBytes += suballoc.size;
7857
7858 // 3. Prepare for next iteration.
7859 lastOffset = suballoc.offset + suballoc.size;
7860 ++nextAlloc2ndIndex;
7861 }
7862 // We are at the end.
7863 else
7864 {
7865 if (lastOffset < freeSpace2ndTo1stEnd)
7866 {
7867 // There is free space from lastOffset to freeSpace2ndTo1stEnd.
7868 ++unusedRangeCount;
7869 }

Callers 2

BuildStatsStringMethod · 0.80
vmaBuildStatsStringFunction · 0.80

Calls 15

IsFreeMethod · 0.80
BeginObjectMethod · 0.80
BeginStringMethod · 0.80
ContinueStringMethod · 0.80
EndStringMethod · 0.80
GetMapRefCountMethod · 0.80
GetPreferredBlockSizeMethod · 0.80
BuildStatsStringMethod · 0.80
BeginArrayMethod · 0.80
GetSizeFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected