From 04592e576d2f1b2acc908ec4e079118d796228d5 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Wed, 30 Sep 2020 18:19:27 +0300 Subject: [PATCH] Fix wsi tests using disallowed image usage Even though STORAGE usage might be reported by VkSurfaceCapabilitiesKHR::supportedUsageFlags, an application should always verify whether for a given format the STORAGE usage is supported through vkGetPhysicalDeviceImageFormatProperties(). This also fixes validation layer warnings (VUID-VkSwapchainCreateInfoKHR-imageFormat-01778). Affects: dEQP-VK.wsi.*.swapchain.simulate_oom.image_usage Components: Vulkan VK-GL-CTS issue: 2602 Change-Id: I21a5faff6206bdeaf6ecd5d8c8024d17965db548 --- .../modules/vulkan/wsi/vktWsiSwapchainTests.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp b/external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp index 837a200d1..f239c44e4 100644 --- a/external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp +++ b/external/vulkancts/modules/vulkan/wsi/vktWsiSwapchainTests.cpp @@ -445,7 +445,9 @@ struct TestParameters {} }; -vector generateSwapchainParameterCases (Type wsiType, +vector generateSwapchainParameterCases (const InstanceInterface& vki, + VkPhysicalDevice physicalDevice, + Type wsiType, TestDimension dimension, const VkSurfaceCapabilitiesKHR& capabilities, const vector& formats, @@ -561,6 +563,17 @@ vector generateSwapchainParameterCases (Type ws { for (deUint32 flags = 1u; flags <= capabilities.supportedUsageFlags; ++flags) { + VkImageFormatProperties imageProps; + + if (vki.getPhysicalDeviceImageFormatProperties(physicalDevice, + baseParameters.imageFormat, + VK_IMAGE_TYPE_2D, + VK_IMAGE_TILING_OPTIMAL, + flags, + (VkImageCreateFlags)0u, + &imageProps) != VK_SUCCESS) + continue; + if ((flags & ~capabilities.supportedUsageFlags) == 0) { cases.push_back(baseParameters); @@ -663,7 +676,7 @@ vector generateSwapchainParameterCases (Type ws physicalDevice, surface); - return generateSwapchainParameterCases(wsiType, dimension, capabilities, formats, presentModes); + return generateSwapchainParameterCases(vki, physicalDevice, wsiType, dimension, capabilities, formats, presentModes); } tcu::TestStatus createSwapchainTest (Context& context, TestParameters params) -- 2.34.1