From: Piotr Byszewski Date: Fri, 24 Feb 2023 14:09:43 +0000 (+0100) Subject: Merge vk-gl-cts/vulkan-cts-1.3.4 into vk-gl-cts/vulkan-cts-1.3.5 X-Git-Tag: upstream/1.3.5~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=648e228b71100bfea090c413c5eafb92cdefa058;p=platform%2Fupstream%2FVK-GL-CTS.git Merge vk-gl-cts/vulkan-cts-1.3.4 into vk-gl-cts/vulkan-cts-1.3.5 Change-Id: I724365674be6594510c2b687ef31caf3d831cdc2 --- 648e228b71100bfea090c413c5eafb92cdefa058 diff --cc external/vulkancts/modules/vulkan/wsi/vktWsiSurfaceTests.cpp index 32b643a80,e214e36da..4400abf72 --- a/external/vulkancts/modules/vulkan/wsi/vktWsiSurfaceTests.cpp +++ b/external/vulkancts/modules/vulkan/wsi/vktWsiSurfaceTests.cpp @@@ -1153,51 -1142,107 +1153,107 @@@ tcu::TestStatus querySurfacePresentMode return tcu::TestStatus(results.getResult(), results.getMessage()); } - tcu::TestStatus querySurfacePresentModesTestSurfaceless (Context& context, Type wsiType) + void checkDeprecatedExtensionGoogleSurfacelessQuery(const vk::InstanceDriver& vk, VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, tcu::ResultCollector& result) { - tcu::TestLog& log = context.getTestContext().getLog(); - tcu::ResultCollector results (log); + const VkSurfaceKHR nullSurface = DE_NULL; - const InstanceHelper instHelper(context, wsiType, vector(1, string("VK_GOOGLE_surfaceless_query"))); - const NativeObjects native (context, instHelper.supportedExtensions, wsiType); - const Unique surface (createSurface(instHelper.vki, instHelper.instance, wsiType, native.getDisplay(), native.getWindow(), context.getTestContext().getCommandLine())); - const VkSurfaceKHR nullSurface = 0; - const vector physicalDevices = enumeratePhysicalDevices(instHelper.vki, instHelper.instance); - - for (size_t deviceNdx = 0; deviceNdx < physicalDevices.size(); ++deviceNdx) + if (isSupportedByAnyQueue(vk, physicalDevice, surface)) { - if (isSupportedByAnyQueue(instHelper.vki, physicalDevices[deviceNdx], *surface)) + deUint32 numModesSurface = 0; + deUint32 numModesNull = 0; + + VK_CHECK(vk.getPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, &numModesSurface, DE_NULL)); + VK_CHECK(vk.getPhysicalDeviceSurfacePresentModesKHR(physicalDevice, nullSurface, &numModesNull, DE_NULL)); + + if (numModesNull == 0) + return; + + // Actual surface needs to have at least the amount of modes that null surface has + if (numModesSurface < numModesNull) { - deUint32 numModesSurface = 0; - deUint32 numModesNull = 0; + result.fail("Number of modes does not match"); + return; + } + + vector modesSurface(numModesSurface); + vector modesNull(numModesNull); - VK_CHECK(instHelper.vki.getPhysicalDeviceSurfacePresentModesKHR(physicalDevices[deviceNdx], *surface, &numModesSurface, DE_NULL)); - VK_CHECK(instHelper.vki.getPhysicalDeviceSurfacePresentModesKHR(physicalDevices[deviceNdx], nullSurface, &numModesNull, DE_NULL)); + VK_CHECK(vk.getPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, &numModesSurface, &modesSurface[0])); + VK_CHECK(vk.getPhysicalDeviceSurfacePresentModesKHR(physicalDevice, nullSurface, &numModesNull, &modesNull[0])); - if (numModesSurface != numModesNull) + // All modes present in null surface should also be present in actual surface + for (deUint32 i = 0; i < modesNull.size(); i++) + { + if (std::find(modesSurface.begin(), modesSurface.end(), modesNull[i]) == modesSurface.end()) { - results.fail("Number of modes does not match"); - continue; + std::string error_string = std::string("Present mode mismatch with mode: ") + getPresentModeKHRName(modesNull[i]); + result.fail(error_string); + break; } + } + } + } + + void checkExtensionGoogleSurfacelessQuery(const vk::InstanceDriver& vk, VkPhysicalDevice physicalDevice, tcu::ResultCollector& result) + { + const VkSurfaceKHR nullSurface = DE_NULL; + const vector validPresentModes { VK_PRESENT_MODE_FIFO_KHR, VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR, VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR }; - vector modesSurface(numModesSurface + 1); - vector modesNull(numModesSurface + 1); + deUint32 numModesNull = 0; + VK_CHECK(vk.getPhysicalDeviceSurfacePresentModesKHR(physicalDevice, nullSurface, &numModesNull, DE_NULL)); - if (numModesSurface > 0) - { - VK_CHECK(instHelper.vki.getPhysicalDeviceSurfacePresentModesKHR(physicalDevices[deviceNdx], *surface, &numModesSurface, &modesSurface[0])); - VK_CHECK(instHelper.vki.getPhysicalDeviceSurfacePresentModesKHR(physicalDevices[deviceNdx], nullSurface, &numModesSurface, &modesNull[0])); - } + if (numModesNull == 0u) + return; + + vector modesNull(numModesNull); + + VK_CHECK(vk.getPhysicalDeviceSurfacePresentModesKHR(physicalDevice, nullSurface, &numModesNull, &modesNull[0])); + + for (deUint32 i = 0; i < modesNull.size(); i++) + { + if (std::find(validPresentModes.begin(), validPresentModes.end(), modesNull[i]) == validPresentModes.end()) + { + std::string error_string = std::string("Present mode mismatch with mode: ") + getPresentModeKHRName(modesNull[i]); + result.fail(error_string); + break; + } + } + } + + tcu::TestStatus querySurfacePresentModesTestSurfaceless (Context& context, Type wsiType) + { + tcu::TestLog& log = context.getTestContext().getLog(); + tcu::ResultCollector results (log); + + const std::string extensionName = "VK_GOOGLE_surfaceless_query"; + const InstanceHelper instHelper (context, wsiType, vector(1, extensionName), DE_NULL); + const NativeObjects native (context, instHelper.supportedExtensions, wsiType); - const Unique surface (createSurface(instHelper.vki, instHelper.instance, wsiType, native.getDisplay(), native.getWindow())); ++ const Unique surface (createSurface(instHelper.vki, instHelper.instance, wsiType, native.getDisplay(), native.getWindow(), context.getTestContext().getCommandLine())); + + deUint32 extensionVersion = 1u; + + // Get "VK_GOOGLE_surfaceless_query" extension's spec version + { + deUint32 propertyCount = 0u; + std::vector extensionsProperties; + vk::VkResult extensionResult; + + extensionResult = context.getPlatformInterface().enumerateInstanceExtensionProperties(DE_NULL, &propertyCount, DE_NULL); + if (extensionResult != vk::VK_SUCCESS) + return tcu::TestStatus(QP_TEST_RESULT_FAIL, "Failed to retrieve spec version for extension " + extensionName); - modesSurface.pop_back(); - modesNull.pop_back(); + extensionsProperties.resize(propertyCount); - for (deUint32 i = 0; i < modesSurface.size(); i++) + extensionResult = context.getPlatformInterface().enumerateInstanceExtensionProperties(DE_NULL, &propertyCount, extensionsProperties.data()); + if (extensionResult != vk::VK_SUCCESS) + return tcu::TestStatus(QP_TEST_RESULT_FAIL, "Failed to retrieve spec version for extension " + extensionName); + + for (const auto& property : extensionsProperties) + { + if (property.extensionName == extensionName) { - if (modesSurface[i] != modesNull[i]) - { - results.fail("Present modes mismatch"); - } + extensionVersion = property.specVersion; + break; } } }