| 1358 | } |
| 1359 | |
| 1360 | static 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 | |
| 1397 | static void RecreateAllocationResource(AllocInfo& allocation) |
| 1398 | { |
no test coverage detected