Fix entry points check for VK_KHR_draw_indirect_count
authorRicardo Garcia <rgarcia@igalia.com>
Thu, 12 May 2022 14:26:44 +0000 (16:26 +0200)
committerMatthew Netsch <quic_mnetsch@quicinc.com>
Thu, 2 Jun 2022 19:05:29 +0000 (19:05 +0000)
VK_KHR_draw_indirect_count was promoted to core in Vulkan 1.2, but its
non-KHR entry points (vkCmdDrawIndirectCount and
vkCmdDrawIndexedIndirectCount) are not mandatory unless the device
supports the extension. In that case, the drawIndirectCount feature bit
will also be true. Any of the two checks is valid.

Affected tests:
dEQP-VK.api.version_check.entry_points

VK-GL-CTS issue: 3679
Components: Vulkan

Change-Id: I95666c1a22bed7da33f58a50307294c4048cd8ff

external/vulkancts/modules/vulkan/api/vktApiVersionCheck.cpp

index 0af3341..fd6a767 100644 (file)
@@ -448,25 +448,39 @@ private:
        deBool regularCheck (const APIContext& ctx, tcu::TestLog& log, deUint32& failsQuantity, const vector<pair<const char*, FunctionOrigin> >& testsArr)
        {
                const deUint32 startingQuantity = failsQuantity;
+
                for (deUint32 ndx = 0u; ndx < testsArr.size(); ++ndx)
                {
-                       if (deStringEqual(testsArr[ndx].first, "vkGetInstanceProcAddr") && m_context.getUsedApiVersion() < VK_API_VERSION_1_2)
+                       const auto&     funcName        = testsArr[ndx].first;
+                       const auto&     funcType        = testsArr[ndx].second;
+                       const auto      apiVersion      = m_context.getUsedApiVersion();
+
+                       if (deStringEqual(funcName, "vkGetInstanceProcAddr") && apiVersion < VK_API_VERSION_1_2)
                                continue;
 
-                       const deUint32 functionType     = testsArr[ndx].second;
-                       if (functionType == FUNCTIONORIGIN_PLATFORM)
-                               checkPlatformFunction(ctx, log, testsArr[ndx].first, DE_TRUE, failsQuantity);
-                       else if (functionType == FUNCTIONORIGIN_INSTANCE)
+                       // VK_KHR_draw_indirect_count was promoted to core in Vulkan 1.2, but these entrypoints are not mandatory unless the
+                       // device supports the extension. In that case, the drawIndirectCount feature bit will also be true. Any of the two
+                       // checks is valid. We use the extension name for convenience here.
+                       if ((deStringEqual(funcName, "vkCmdDrawIndirectCount") || deStringEqual(funcName, "vkCmdDrawIndexedIndirectCount"))
+                               && !isSupportedDeviceExt("VK_KHR_draw_indirect_count", apiVersion))
+                               continue;
+
+                       if (funcType == FUNCTIONORIGIN_PLATFORM)
                        {
-                               checkInstanceFunction(ctx, log, testsArr[ndx].first, DE_TRUE, failsQuantity);
-                               checkDeviceFunction(ctx, log, testsArr[ndx].first, DE_FALSE, failsQuantity);
+                               checkPlatformFunction(ctx, log, funcName, DE_TRUE, failsQuantity);
                        }
-                       else if (functionType == FUNCTIONORIGIN_DEVICE)
+                       else if (funcType == FUNCTIONORIGIN_INSTANCE)
                        {
-                               checkInstanceFunction(ctx, log, testsArr[ndx].first, DE_TRUE, failsQuantity);
-                               checkDeviceFunction(ctx, log, testsArr[ndx].first, DE_TRUE, failsQuantity);
+                               checkInstanceFunction(ctx, log, funcName, DE_TRUE, failsQuantity);
+                               checkDeviceFunction(ctx, log, funcName, DE_FALSE, failsQuantity);
+                       }
+                       else if (funcType == FUNCTIONORIGIN_DEVICE)
+                       {
+                               checkInstanceFunction(ctx, log, funcName, DE_TRUE, failsQuantity);
+                               checkDeviceFunction(ctx, log, funcName, DE_TRUE, failsQuantity);
                        }
                }
+
                return startingQuantity == failsQuantity;
        }
 };