Prevent RT tests from going over VkPhysicalDeviceVulkan11Properties::maxMemoryAllocat...
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Wed, 6 Oct 2021 14:45:53 +0000 (17:45 +0300)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Fri, 5 Nov 2021 14:48:45 +0000 (14:48 +0000)
VK-GL-CTS issue: 3064
Component: Vulkan

Affects:
dEQP-VK.ray_tracing_pipeline.misc.max*

Change-Id: Ia42f5530206eeeb94fa634ad84a213c2db558946

external/vulkancts/modules/vulkan/ray_tracing/vktRayTracingMiscTests.cpp

index b864120..1acef42 100644 (file)
@@ -7880,7 +7880,6 @@ public:
                                                                        TestBase*                               testPtr);
        ~RayTracingMiscTestInstance (   void);
 
-       bool                    init    (void);
        tcu::TestStatus iterate (void);
 
 protected:
@@ -7897,26 +7896,24 @@ private:
 RayTracingMiscTestInstance::RayTracingMiscTestInstance (Context&                                       context,
                                                                                                                const CaseDef&                          data,
                                                                                                                TestBase*                                       testPtr)
-       : vkt::TestInstance     (context)
-       , m_data                        (data)
-       , m_testPtr                     (testPtr)
+       : vkt::TestInstance                     (context)
+       , m_data                                        (data)
+       , m_rayTracingPropsPtr          (makeRayTracingProperties(context.getInstanceInterface(),
+                                                                                                                 context.getPhysicalDevice()))
+       , m_testPtr                                     (testPtr)
 {
-}
+       m_testPtr->init(m_context, m_rayTracingPropsPtr.get());
+ }
 
 RayTracingMiscTestInstance::~RayTracingMiscTestInstance(void)
 {
        /* Stub */
 }
 
-bool RayTracingMiscTestInstance::init()
+void RayTracingMiscTestInstance::checkSupport(void) const
 {
-       const auto& instanceInterface = m_context.getInstanceInterface();
-       const auto& physicalDeviceVk  = m_context.getPhysicalDevice   ();
-
-       m_rayTracingPropsPtr = makeRayTracingProperties(instanceInterface,
-                                                                                                       physicalDeviceVk);
-
-       return true;
+       if (m_testPtr->getResultBufferSize() > m_context.getDeviceVulkan11Properties().maxMemoryAllocationSize)
+               TCU_THROW(NotSupportedError, "VkPhysicalDeviceVulkan11Properties::maxMemoryAllocationSize too small, allocation might fail");
 }
 
 de::MovePtr<BufferWithMemory> RayTracingMiscTestInstance::runTest(void)
@@ -7929,10 +7926,6 @@ de::MovePtr<BufferWithMemory> RayTracingMiscTestInstance::runTest(void)
        Allocator&                              allocator                       = m_context.getDefaultAllocator                 ();
 
        de::MovePtr<BufferWithMemory>                                   resultBufferPtr;
-       auto                                                                                    rtPropertiesPtr         = makeRayTracingProperties(m_context.getInstanceInterface(), m_context.getPhysicalDevice() );
-
-       m_testPtr->init(m_context,
-                                       rtPropertiesPtr.get() );
 
        // Determine group indices
        const auto ahitCollectionShaderNameVec                  = m_testPtr->getAHitShaderCollectionShaderNames                 ();
@@ -8281,7 +8274,7 @@ de::MovePtr<BufferWithMemory> RayTracingMiscTestInstance::runTest(void)
                                                0u /* flags */);
        {
                m_testPtr->initAS(      m_context,
-                                                       rtPropertiesPtr.get(),
+                                                       m_rayTracingPropsPtr.get(),
                                                        *cmdBufferPtr);
 
                std::vector<TopLevelAccelerationStructure*> tlasPtrVec = m_testPtr->getTLASPtrVecToBind();
@@ -8460,6 +8453,8 @@ de::MovePtr<BufferWithMemory> RayTracingMiscTestInstance::runTest(void)
 
 tcu::TestStatus RayTracingMiscTestInstance::iterate (void)
 {
+       checkSupport();
+
        const de::MovePtr<BufferWithMemory>     bufferGPUPtr            = runTest();
        const deUint32*                                         bufferGPUDataPtr        = (deUint32*) bufferGPUPtr->getAllocation().getHostPtr();
        const bool                                                      result                          = m_testPtr->verifyResultBuffer(bufferGPUDataPtr);
@@ -9226,8 +9221,6 @@ TestInstance* RayTracingTestCase::createInstance (Context& context) const
                                                                                                                                m_data,
                                                                                                                                m_testPtr.get           () );
 
-       newTestInstancePtr->init();
-
        return newTestInstancePtr;
 }