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

Function ValidateAllocationData

src/Tests.cpp:1360–1395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1358}
1359
1360static void ValidateAllocationData(const AllocInfo& allocation)
1361{
1362 VmaAllocationInfo allocInfo;
1363 vmaGetAllocationInfo(g_hAllocator, allocation.m_Allocation, &allocInfo);
1364
1365 uint32_t* data = (uint32_t*)allocInfo.pMappedData;
1366 if(allocInfo.pMappedData == nullptr)
1367 {
1368 VkResult res = vmaMapMemory(g_hAllocator, allocation.m_Allocation, (void**)&data);
1369 TEST(res == VK_SUCCESS);
1370 }
1371
1372 uint32_t value = allocation.m_StartValue;
1373 bool ok = true;
1374 if(allocation.m_Buffer)
1375 {
1376 TEST(allocInfo.size % 4 == 0);
1377 for(size_t i = 0; i < allocInfo.size / sizeof(uint32_t); ++i)
1378 {
1379 if(data[i] != value++)
1380 {
1381 ok = false;
1382 break;
1383 }
1384 }
1385 }
1386 else
1387 {
1388 TEST(allocation.m_Image);
1389 // Images not currently supported.
1390 }
1391 TEST(ok);
1392
1393 if(allocInfo.pMappedData == nullptr)
1394 vmaUnmapMemory(g_hAllocator, allocation.m_Allocation);
1395}
1396
1397static void RecreateAllocationResource(AllocInfo& allocation)
1398{

Callers 1

ValidateAllocationsDataFunction · 0.85

Calls 4

vmaGetAllocationInfoFunction · 0.85
vmaMapMemoryFunction · 0.85
TESTEnum · 0.85
vmaUnmapMemoryFunction · 0.85

Tested by

no test coverage detected