Fix stack underflow in incremental present test
authorLingfeng Yang <lfy@google.com>
Fri, 8 Feb 2019 15:36:00 +0000 (07:36 -0800)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 22 Feb 2019 10:53:51 +0000 (05:53 -0500)
This uses the current object's m_queueFamilyIndex instead of a queue
family index that is on the stack, avoiding using a stale stack address
when the test runs.

VK-GL-CTS issue: 1585

Affects:
dEQP-VK.wsi.*.incremental_present.*

Components: Vulkan

Change-Id: I80228651b799d3444676cdcbf5cc845bcb195fe9

external/vulkancts/modules/vulkan/wsi/vktWsiIncrementalPresentTests.cpp

index 9b851b2..13f7aa6 100644 (file)
@@ -709,7 +709,7 @@ private:
 };
 
 std::vector<vk::VkSwapchainCreateInfoKHR> generateSwapchainConfigs (vk::VkSurfaceKHR                                           surface,
-                                                                                                                                       deUint32                                                                queueFamilyIndex,
+                                                                                                                                       const deUint32                                                  *queueFamilyIndex,
                                                                                                                                        Scaling                                                                 scaling,
                                                                                                                                        const vk::VkSurfaceCapabilitiesKHR&             properties,
                                                                                                                                        const vector<vk::VkSurfaceFormatKHR>&   formats,
@@ -784,7 +784,7 @@ std::vector<vk::VkSwapchainCreateInfoKHR> generateSwapchainConfigs (vk::VkSurfac
                                        imageUsage,
                                        vk::VK_SHARING_MODE_EXCLUSIVE,
                                        1u,
-                                       &queueFamilyIndex,
+                                       queueFamilyIndex,
                                        preTransform,
                                        compositeAlpha,
                                        presentMode,
@@ -809,7 +809,7 @@ std::vector<vk::VkSwapchainCreateInfoKHR> generateSwapchainConfigs (vk::VkSurfac
                                        imageUsage,
                                        vk::VK_SHARING_MODE_EXCLUSIVE,
                                        1u,
-                                       &queueFamilyIndex,
+                                       queueFamilyIndex,
                                        preTransform,
                                        compositeAlpha,
                                        presentMode,
@@ -856,7 +856,7 @@ IncrementalPresentTestInstance::IncrementalPresentTestInstance (Context& context
        , m_freeAcquireSemaphore        ((vk::VkSemaphore)0)
        , m_freeRenderSemaphore         ((vk::VkSemaphore)0)
 
-       , m_swapchainConfigs            (generateSwapchainConfigs(*m_surface, m_queueFamilyIndex, testConfig.scaling, m_surfaceProperties, m_surfaceFormats, m_presentModes, testConfig.presentMode))
+       , m_swapchainConfigs            (generateSwapchainConfigs(*m_surface, &m_queueFamilyIndex, testConfig.scaling, m_surfaceProperties, m_surfaceFormats, m_presentModes, testConfig.presentMode))
        , m_swapchainConfigNdx          (0u)
 
        , m_frameCount                          (60u * 5u)
@@ -1079,7 +1079,7 @@ tcu::TestStatus IncrementalPresentTestInstance::iterate (void)
        {
                if (error.getError() == vk::VK_ERROR_OUT_OF_DATE_KHR)
                {
-                       m_swapchainConfigs = generateSwapchainConfigs(*m_surface, m_queueFamilyIndex, m_testConfig.scaling, m_surfaceProperties, m_surfaceFormats, m_presentModes, m_testConfig.presentMode);
+                       m_swapchainConfigs = generateSwapchainConfigs(*m_surface, &m_queueFamilyIndex, m_testConfig.scaling, m_surfaceProperties, m_surfaceFormats, m_presentModes, m_testConfig.presentMode);
 
                        if (m_outOfDateCount < m_maxOutOfDateCount)
                        {