MCPcopy Create free account
hub / github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator / CheckCorruption

Method CheckCorruption

include/vk_mem_alloc.h:8447–8479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8445}
8446
8447VkResult VmaBlockMetadata_Linear::CheckCorruption(const void* pBlockData)
8448{
8449 VMA_ASSERT(!IsVirtual());
8450 SuballocationVectorType& suballocations1st = AccessSuballocations1st();
8451 for (size_t i = m_1stNullItemsBeginCount, count = suballocations1st.size(); i < count; ++i)
8452 {
8453 const VmaSuballocation& suballoc = suballocations1st[i];
8454 if (suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)
8455 {
8456 if (!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))
8457 {
8458 VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!");
8459 return VK_ERROR_UNKNOWN_COPY;
8460 }
8461 }
8462 }
8463
8464 SuballocationVectorType& suballocations2nd = AccessSuballocations2nd();
8465 for (size_t i = 0, count = suballocations2nd.size(); i < count; ++i)
8466 {
8467 const VmaSuballocation& suballoc = suballocations2nd[i];
8468 if (suballoc.type != VMA_SUBALLOCATION_TYPE_FREE)
8469 {
8470 if (!VmaValidateMagicValue(pBlockData, suballoc.offset + suballoc.size))
8471 {
8472 VMA_ASSERT(0 && "MEMORY CORRUPTION DETECTED AFTER VALIDATED ALLOCATION!");
8473 return VK_ERROR_UNKNOWN_COPY;
8474 }
8475 }
8476 }
8477
8478 return VK_SUCCESS;
8479}
8480
8481void VmaBlockMetadata_Linear::Alloc(
8482 const VmaAllocationRequest& request,

Callers 1

CheckPoolCorruptionMethod · 0.80

Calls 6

VmaValidateMagicValueFunction · 0.85
IsFreeMethod · 0.80
sizeMethod · 0.45
FrontMethod · 0.45
GetNextMethod · 0.45
GetMemoryTypeIndexMethod · 0.45

Tested by

no test coverage detected