Skip to content

Commit

Permalink
A fix in TestPool_Benchmark for GPUs with only 256 MB of DEVICE_LOCAL…
Browse files Browse the repository at this point in the history
… memory
  • Loading branch information
adam-sawicki-a committed Feb 18, 2021
1 parent 2882236 commit 26eaa3b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/SparseBindingTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,8 @@ void TestSparseBinding()

// Free remaining images.
images.clear();

wprintf(L"Done.\n");
}

#endif // #ifdef _WIN32
21 changes: 15 additions & 6 deletions src/Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4414,13 +4414,22 @@ static void TestPool_Benchmark(
poolCreateInfo.blockSize = config.PoolSize;
poolCreateInfo.frameInUseCount = 1;

VmaAllocationCreateInfo dummyAllocCreateInfo = {};
dummyAllocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
vmaFindMemoryTypeIndex(g_hAllocator, memoryTypeBits, &dummyAllocCreateInfo, &poolCreateInfo.memoryTypeIndex);
VmaPool pool = VK_NULL_HANDLE;
VkResult res;
// 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;
VkResult res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool);
TEST(res == VK_SUCCESS);
res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool);
if(res == VK_SUCCESS)
break;
memoryTypeBits &= ~(1u << poolCreateInfo.memoryTypeIndex);
}
TEST(pool);

// Start time measurement - after creating pool and initializing data structures.
time_point timeBeg = std::chrono::high_resolution_clock::now();
Expand Down

0 comments on commit 26eaa3b

Please sign in to comment.