A fix in TestPool_Benchmark for GPUs with only 256 MB of DEVICE_LOCAL memory

This commit is contained in:
Adam Sawicki 2021-02-18 15:53:18 +01:00
parent 2882236f6a
commit 26eaa3b2ed
2 changed files with 17 additions and 6 deletions

View File

@ -588,6 +588,8 @@ void TestSparseBinding()
// Free remaining images. // Free remaining images.
images.clear(); images.clear();
wprintf(L"Done.\n");
} }
#endif // #ifdef _WIN32 #endif // #ifdef _WIN32

View File

@ -4414,13 +4414,22 @@ static void TestPool_Benchmark(
poolCreateInfo.blockSize = config.PoolSize; poolCreateInfo.blockSize = config.PoolSize;
poolCreateInfo.frameInUseCount = 1; poolCreateInfo.frameInUseCount = 1;
VmaAllocationCreateInfo dummyAllocCreateInfo = {}; VmaPool pool = VK_NULL_HANDLE;
dummyAllocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY; VkResult res;
vmaFindMemoryTypeIndex(g_hAllocator, memoryTypeBits, &dummyAllocCreateInfo, &poolCreateInfo.memoryTypeIndex); // Loop over memory types because we sometimes allocate a big block here,
// while the most eligible DEVICE_LOCAL heap may be only 256 MB on some GPUs.
while(memoryTypeBits)
{
VmaAllocationCreateInfo dummyAllocCreateInfo = {};
dummyAllocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
vmaFindMemoryTypeIndex(g_hAllocator, memoryTypeBits, &dummyAllocCreateInfo, &poolCreateInfo.memoryTypeIndex);
VmaPool pool; res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool);
VkResult res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool); if(res == VK_SUCCESS)
TEST(res == VK_SUCCESS); break;
memoryTypeBits &= ~(1u << poolCreateInfo.memoryTypeIndex);
}
TEST(pool);
// Start time measurement - after creating pool and initializing data structures. // Start time measurement - after creating pool and initializing data structures.
time_point timeBeg = std::chrono::high_resolution_clock::now(); time_point timeBeg = std::chrono::high_resolution_clock::now();