Reduce dEQP-VK.pipeline.render_to_image allocs to within platform limits
authorTom Cooper <tom.cooper@arm.com>
Mon, 28 Oct 2019 15:04:36 +0000 (15:04 +0000)
committerTom Cooper <tom.cooper@arm.com>
Tue, 12 Nov 2019 10:04:13 +0000 (05:04 -0500)
These tests allocate an image of upto 25% of VkMemoryHeap heapSize and
should be limited to the value in
PlatformMemoryLimits.totalSystemMemory.

Component: Vulkan

VK-GL-CTS Issue: 2087

Affects:
dEQP-VK.pipeline.render_to_image*

Change-Id: Ie7d775cc55fdb54e448fc1c973d1e17925711e47

external/vulkancts/modules/vulkan/pipeline/vktPipelineRenderToImageTests.cpp

index 2b3c139..72f3f7d 100644 (file)
@@ -40,6 +40,8 @@
 #include "tcuTextureUtil.hpp"
 #include "tcuImageCompare.hpp"
 #include "tcuTestLog.hpp"
+#include "tcuPlatform.hpp"
+#include "vkPlatform.hpp"
 
 #include "deUniquePtr.hpp"
 #include "deSharedPtr.hpp"
@@ -902,6 +904,10 @@ tcu::TestStatus testWithSizeReduction (Context& context, const CaseDef& caseDef)
        VkDeviceSize                                    neededMemory            = static_cast<VkDeviceSize>(static_cast<float>(colorSize + depthStencilSize) * additionalMemory) + reserveForChecking;
        VkDeviceSize                                    maxMemory                       = getMaxDeviceHeapSize(context, caseDef) >> 2;
 
+       vk::PlatformMemoryLimits                memoryLimits;
+       context.getTestContext().getPlatform().getVulkanPlatform().getMemoryLimits(memoryLimits);
+       maxMemory = std::min(maxMemory, VkDeviceSize(memoryLimits.totalSystemMemory));
+
        const VkDeviceSize                              deviceMemoryBudget      = std::min(neededMemory, maxMemory);
        bool                                                    allocationPossible      = false;