Fix in tests for AMD APU with DEVICE_LOCAL heap of only 256 MB

This commit is contained in:
Adam Sawicki 2021-02-23 15:27:24 +01:00
parent a9a458c7d1
commit 7e56c486fa
2 changed files with 19 additions and 5 deletions

View File

@ -532,6 +532,8 @@ SparseBindingImage::~SparseBindingImage()
void TestSparseBinding()
{
wprintf(L"TESTING SPARSE BINDING:");
struct ImageInfo
{
std::unique_ptr<BaseImage> image;

View File

@ -4408,12 +4408,14 @@ static void TestPool_Benchmark(
TEST(0);
VmaPoolCreateInfo poolCreateInfo = {};
poolCreateInfo.memoryTypeIndex = 0;
poolCreateInfo.minBlockCount = 1;
poolCreateInfo.maxBlockCount = 1;
poolCreateInfo.blockSize = config.PoolSize;
poolCreateInfo.frameInUseCount = 1;
const VkPhysicalDeviceMemoryProperties* memProps = nullptr;
vmaGetMemoryProperties(g_hAllocator, &memProps);
VmaPool pool = VK_NULL_HANDLE;
VkResult res;
// Loop over memory types because we sometimes allocate a big block here,
@ -4424,9 +4426,15 @@ static void TestPool_Benchmark(
dummyAllocCreateInfo.usage = VMA_MEMORY_USAGE_GPU_ONLY;
vmaFindMemoryTypeIndex(g_hAllocator, memoryTypeBits, &dummyAllocCreateInfo, &poolCreateInfo.memoryTypeIndex);
res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool);
if(res == VK_SUCCESS)
break;
const uint32_t heapIndex = memProps->memoryTypes[poolCreateInfo.memoryTypeIndex].heapIndex;
// Protection against validation layer error when trying to allocate a block larger than entire heap size,
// which may be only 256 MB on some platforms.
if(poolCreateInfo.blockSize * poolCreateInfo.minBlockCount < memProps->memoryHeaps[heapIndex].size)
{
res = vmaCreatePool(g_hAllocator, &poolCreateInfo, &pool);
if(res == VK_SUCCESS)
break;
}
memoryTypeBits &= ~(1u << poolCreateInfo.memoryTypeIndex);
}
TEST(pool);
@ -5704,6 +5712,8 @@ static void PerformCustomPoolTest(FILE* file)
static void PerformMainTests(FILE* file)
{
wprintf(L"MAIN TESTS:\n");
uint32_t repeatCount = 1;
if(ConfigType >= CONFIG_TYPE_MAXIMUM) repeatCount = 3;
@ -5969,6 +5979,8 @@ static void PerformMainTests(FILE* file)
static void PerformPoolTests(FILE* file)
{
wprintf(L"POOL TESTS:\n");
const size_t AVG_RESOURCES_PER_POOL = 300;
uint32_t repeatCount = 1;
@ -6503,7 +6515,7 @@ void Test()
fclose(file);
wprintf(L"Done.\n");
wprintf(L"Done, all PASSED.\n");
}
#endif // #ifdef _WIN32