Fix issues in memory tests.
authorMika Isojärvi <misojarvi@google.com>
Mon, 4 Jan 2016 23:40:42 +0000 (15:40 -0800)
committerMika Isojärvi <misojarvi@google.com>
Wed, 6 Jan 2016 22:52:54 +0000 (14:52 -0800)
Change memory mapping tests to use 1/16th of memory at most.
Change memory allocation tests to use 1/8th of memory at most.
Fix number of ranges in random flush and random finish calls.

Change-Id: Ie8c5ad688c6243c69ea5de8681cf3b4e4a7c5c93

external/vulkancts/modules/vulkan/memory/vktMemoryAllocationTests.cpp
external/vulkancts/modules/vulkan/memory/vktMemoryMappingTests.cpp

index 1ad6702..3582487 100644 (file)
@@ -147,7 +147,7 @@ tcu::TestStatus AllocateFreeTestInstance::iterate (void)
                        log << TestLog::Message << "Memory type: " << memoryType << TestLog::EndMessage;
                        log << TestLog::Message << "Memory heap: " << memoryHeap << TestLog::EndMessage;
 
-                       if (allocationSize * m_config.memoryAllocationCount * 4 > memoryHeap.size)
+                       if (allocationSize * m_config.memoryAllocationCount * 8 > memoryHeap.size)
                                TCU_THROW(NotSupportedError, "Memory heap doesn't have enough memory.");
 
                        try
@@ -300,7 +300,7 @@ RandomAllocFreeTestInstance::RandomAllocFreeTestInstance    (Context& context, deUi
        {
                m_heaps[heapNdx].heap                   = memoryProperties.memoryHeaps[heapNdx];
                m_heaps[heapNdx].memoryUsage    = 0;
-               m_heaps[heapNdx].maxMemoryUsage = m_heaps[heapNdx].heap.size / 4;
+               m_heaps[heapNdx].maxMemoryUsage = m_heaps[heapNdx].heap.size / 8;
 
                m_heaps[heapNdx].objects.reserve(100);
 
@@ -348,7 +348,7 @@ tcu::TestStatus RandomAllocFreeTestInstance::iterate (void)
        if (m_opNdx == 0)
        {
                log << TestLog::Message << "Performing " << m_opCount << " random VkAllocMemory() / VkFreeMemory() calls before freeing all memory." << TestLog::EndMessage;
-               log << TestLog::Message << "Using max one fourth of the memory in each memory heap." << TestLog::EndMessage;
+               log << TestLog::Message << "Using max 1/8 of the memory in each memory heap." << TestLog::EndMessage;
        }
 
        if (m_opNdx >= m_opCount)
@@ -477,7 +477,7 @@ tcu::TestCaseGroup* createAllocationTests (tcu::TestContext& testCtx)
 
        const float allocationPercents[] =
        {
-               0.01f, 0.1f, 0.25f
+               0.01f
        };
 
        const int allocationCounts[] =
@@ -566,7 +566,7 @@ tcu::TestCaseGroup* createAllocationTests (tcu::TestContext& testCtx)
                                {
                                        const int allocationCount = allocationCounts[allocationCountNdx];
 
-                                       if ((allocationCount != -1) && ((float)allocationCount * allocationPercent > 0.25f))
+                                       if ((allocationCount != -1) && ((float)allocationCount * allocationPercent >= 1.00f / 8.00f))
                                                continue;
 
                                        TestConfig config;
@@ -576,7 +576,7 @@ tcu::TestCaseGroup* createAllocationTests (tcu::TestContext& testCtx)
 
                                        if (allocationCount == -1)
                                        {
-                                               config.memoryAllocationCount    = (int)(0.25f / allocationPercent);
+                                               config.memoryAllocationCount    = (int)((1.00f / 8.00f) / allocationPercent);
 
                                                if (config.memoryAllocationCount == 0
                                                        || config.memoryAllocationCount == 1
index 7034149..ea3cd65 100644 (file)
@@ -479,7 +479,7 @@ void MemoryObject::unmap (void)
 
 void MemoryObject::randomFlush (const DeviceInterface& vkd, VkDevice device, de::Random& rng)
 {
-       const size_t                            rangeCount      = (size_t)rng.getInt(0, 10);
+       const size_t                            rangeCount      = (size_t)rng.getInt(1, 10);
        vector<VkMappedMemoryRange>     ranges          (rangeCount);
 
        randomRanges(rng, ranges, rangeCount, *m_memory, m_size);
@@ -489,7 +489,7 @@ void MemoryObject::randomFlush (const DeviceInterface& vkd, VkDevice device, de:
 
 void MemoryObject::randomInvalidate (const DeviceInterface& vkd, VkDevice device, de::Random& rng)
 {
-       const size_t                            rangeCount      = (size_t)rng.getInt(0, 10);
+       const size_t                            rangeCount      = (size_t)rng.getInt(1, 10);
        vector<VkMappedMemoryRange>     ranges          (rangeCount);
 
        randomRanges(rng, ranges, rangeCount, *m_memory, m_size);
@@ -499,8 +499,8 @@ void MemoryObject::randomInvalidate (const DeviceInterface& vkd, VkDevice device
 
 enum
 {
-       // Use only 1/8 of each memory heap.
-       MAX_MEMORY_USAGE_DIV = 8
+       // Use only 1/16 of each memory heap.
+       MAX_MEMORY_USAGE_DIV = 16
 };
 
 template<typename T>