Add tests for VK_EXT_tooling_info
authorMarcin Kańtoch <marcin.kantoch@amd.com>
Tue, 26 Nov 2019 19:54:48 +0000 (20:54 +0100)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 3 Apr 2020 11:59:26 +0000 (07:59 -0400)
New Tests:
dEQP-VK.api.tooling_info.*

Components: Vulkan

VK-GL-CTS issue: 2182

Change-Id: I96044ae014bb0cb5d5e89471ef0b7d21baac91d8
(cherry picked from commit 058ba3e5f06cb5bec6fbb6a473347bd7a97b2f43)

AndroidGen.mk
android/cts/master/vk-master-2020-03-01.txt
android/cts/master/vk-master.txt
external/vulkancts/modules/vulkan/api/CMakeLists.txt
external/vulkancts/modules/vulkan/api/vktApiTests.cpp
external/vulkancts/modules/vulkan/api/vktApiToolingInfoTests.cpp [new file with mode: 0644]
external/vulkancts/modules/vulkan/api/vktApiToolingInfoTests.hpp [new file with mode: 0644]
external/vulkancts/mustpass/master/vk-default-no-waivers.txt
external/vulkancts/mustpass/master/vk-default.txt

index 87a1650..d317943 100644 (file)
@@ -91,6 +91,7 @@ LOCAL_SRC_FILES := \
        external/vulkancts/modules/vulkan/api/vktApiPipelineTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiSmokeTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiTests.cpp \
+       external/vulkancts/modules/vulkan/api/vktApiToolingInfoTests.cpp \
        external/vulkancts/modules/vulkan/api/vktApiVersionCheck.cpp \
        external/vulkancts/modules/vulkan/binding_model/vktBindingBufferDeviceAddressTests.cpp \
        external/vulkancts/modules/vulkan/binding_model/vktBindingDescriptorCopyTests.cpp \
index f43e89c..250c23c 100644 (file)
@@ -26277,6 +26277,8 @@ dEQP-VK.api.external.memory.dma_buf.dedicated.image.info
 dEQP-VK.api.external.memory.dma_buf.dedicated.image.bind_export_import_bind
 dEQP-VK.api.external.memory.dma_buf.dedicated.image.export_bind_import_bind
 dEQP-VK.api.external.memory.dma_buf.dedicated.image.export_import_bind_bind
+dEQP-VK.api.tooling_info.validate_getter
+dEQP-VK.api.tooling_info.validate_tools_properties
 dEQP-VK.memory.pipeline_barrier.host_write_vertex_buffer.1024_vertex_buffer_stride_4
 dEQP-VK.memory.pipeline_barrier.host_write_vertex_buffer.8192_vertex_buffer_stride_4
 dEQP-VK.memory.pipeline_barrier.host_write_vertex_buffer.65536_vertex_buffer_stride_4
index 8db94f9..ca0b81f 100644 (file)
@@ -114200,6 +114200,8 @@ dEQP-VK.api.pipeline.renderpass.framebuffer_compatible_renderpass
 dEQP-VK.api.pipeline.pipeline_layout.lifetime.graphics
 dEQP-VK.api.pipeline.pipeline_layout.lifetime.compute
 dEQP-VK.api.invariance.random
+dEQP-VK.api.tooling_info.validate_getter
+dEQP-VK.api.tooling_info.validate_tools_properties
 dEQP-VK.memory.allocation.basic.size_64.forward.count_1
 dEQP-VK.memory.allocation.basic.size_64.forward.count_10
 dEQP-VK.memory.allocation.basic.size_64.forward.count_100
index 0fd6c24..1a6b782 100644 (file)
@@ -60,6 +60,8 @@ set(DEQP_VK_API_SRCS
        vktApiPipelineTests.cpp
        vktApiMemoryRequirementInvarianceTests.cpp
        vktApiMemoryRequirementInvarianceTests.hpp
+    vktApiToolingInfoTests.cpp
+    vktApiToolingInfoTests.hpp
        )
 
 set(DEQP_VK_API_LIBS
index e19a14d..41abc7d 100644 (file)
@@ -47,6 +47,7 @@
 #include "vktApiDescriptorSetTests.hpp"
 #include "vktApiPipelineTests.hpp"
 #include "vktApiMemoryRequirementInvarianceTests.hpp"
+#include "vktApiToolingInfoTests.hpp"
 
 namespace vkt
 {
@@ -90,6 +91,7 @@ void createApiTests (tcu::TestCaseGroup* apiTests)
        apiTests->addChild(createDescriptorSetTests                                     (testCtx));
        apiTests->addChild(createPipelineTests                                          (testCtx));
        apiTests->addChild(createMemoryRequirementInvarianceTests       (testCtx));
+       apiTests->addChild(createToolingInfoTests                                       (testCtx));
 }
 
 } // anonymous
diff --git a/external/vulkancts/modules/vulkan/api/vktApiToolingInfoTests.cpp b/external/vulkancts/modules/vulkan/api/vktApiToolingInfoTests.cpp
new file mode 100644 (file)
index 0000000..83baa69
--- /dev/null
@@ -0,0 +1,228 @@
+/*-------------------------------------------------------------------------
+* Vulkan Conformance Tests
+* ------------------------
+*
+* Copyright (c) 2019 Advanced Micro Devices, Inc.
+* Copyright (c) 2019 The Khronos Group Inc.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*//*!
+* \file
+* \brief VK_EXT_tooling_info tests
+*//*--------------------------------------------------------------------*/
+
+#include "vktApiToolingInfoTests.hpp"
+#include "vktTestGroupUtil.hpp"
+#include "vktTestCaseUtil.hpp"
+#include "vkQueryUtil.hpp"
+#include "vkStrUtil.hpp"
+#include "vkTypeUtil.hpp"
+#include "tcuTestLog.hpp"
+#include <iostream>
+#include <string>
+#include <vector>
+
+#include <string.h>
+
+using namespace vk;
+
+namespace vkt
+{
+namespace api
+{
+namespace
+{
+
+bool validateToolPurposeFlagBits(const VkToolPurposeFlagsEXT purposes)
+{
+       const VkToolPurposeFlagsEXT validPurposes =     VK_TOOL_PURPOSE_VALIDATION_BIT_EXT                      |
+                                                                                               VK_TOOL_PURPOSE_PROFILING_BIT_EXT                       |
+                                                                                               VK_TOOL_PURPOSE_TRACING_BIT_EXT                         |
+                                                                                               VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT     |
+                                                                                               VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT      |
+                                                                                               VK_TOOL_PURPOSE_DEBUG_REPORTING_BIT_EXT         |
+                                                                                               VK_TOOL_PURPOSE_DEBUG_MARKERS_BIT_EXT;
+       return (purposes | validPurposes) == validPurposes;
+}
+
+void checkSupport (Context& context)
+{
+       context.requireDeviceFunctionality("VK_EXT_tooling_info");
+}
+
+tcu::TestStatus validateGetter(Context& context)
+{
+       tcu::TestLog& testLog = context.getTestContext().getLog();
+
+       VkResult result         = VK_SUCCESS;
+       deUint32 toolCount      = 0;
+
+       result = context.getInstanceInterface().getPhysicalDeviceToolPropertiesEXT(context.getPhysicalDevice(), &toolCount, DE_NULL);
+
+       if(result != VK_SUCCESS)
+       {
+               testLog << tcu::TestLog::Message << "getPhysicalDeviceToolPropertiesEXT wrong result code" << tcu::TestLog::EndMessage;
+               return tcu::TestStatus::fail("Fail");
+       }
+
+       if (toolCount > 0)
+       {
+               deUint32 toolCountSecondCall = toolCount;
+
+               std::vector<VkPhysicalDeviceToolPropertiesEXT>  deviceToolPropertiesEXTArray(toolCountSecondCall);
+
+               result = context.getInstanceInterface().getPhysicalDeviceToolPropertiesEXT(context.getPhysicalDevice(), &toolCountSecondCall, &deviceToolPropertiesEXTArray[0]);
+
+               if (result != VK_SUCCESS)
+               {
+                       testLog << tcu::TestLog::Message << "getPhysicalDeviceToolPropertiesEXT wrong result code" << tcu::TestLog::EndMessage;
+                       return tcu::TestStatus::fail("Fail");
+               }
+
+               if (toolCountSecondCall != toolCount)
+               {
+                       testLog << tcu::TestLog::Message << "Got different tools count on the second call" << tcu::TestLog::EndMessage;
+                       return tcu::TestStatus::fail("Fail");
+               }
+
+               toolCountSecondCall++;
+
+               deviceToolPropertiesEXTArray.resize(toolCountSecondCall);
+
+               result = context.getInstanceInterface().getPhysicalDeviceToolPropertiesEXT(context.getPhysicalDevice(), &toolCountSecondCall, &deviceToolPropertiesEXTArray[0]);
+
+               if (result != VK_SUCCESS)
+               {
+                       testLog << tcu::TestLog::Message << "getPhysicalDeviceToolPropertiesEXT wrong result code" << tcu::TestLog::EndMessage;
+                       return tcu::TestStatus::fail("Fail");
+               }
+
+               if (toolCountSecondCall != toolCount)
+               {
+                       testLog << tcu::TestLog::Message << "Bigger array causes an error" << tcu::TestLog::EndMessage;
+                       return tcu::TestStatus::fail("Fail");
+               }
+
+               toolCountSecondCall = 0;
+
+               result = context.getInstanceInterface().getPhysicalDeviceToolPropertiesEXT(context.getPhysicalDevice(), &toolCountSecondCall, &deviceToolPropertiesEXTArray[0]);
+
+               if (result != VK_INCOMPLETE)
+               {
+                       testLog << tcu::TestLog::Message << "getPhysicalDeviceToolPropertiesEXT wrong result code" << tcu::TestLog::EndMessage;
+                       return tcu::TestStatus::fail("Fail");
+               }
+
+               if (toolCountSecondCall != 0)
+               {
+                       testLog << tcu::TestLog::Message << "Zero array causes an error" << tcu::TestLog::EndMessage;
+                       return tcu::TestStatus::fail("Fail");
+               }
+       }
+
+       if (toolCount > 1)
+       {
+               deUint32 toolCountSecondCall = toolCount / 2;
+
+               std::vector<VkPhysicalDeviceToolPropertiesEXT>  deviceToolPropertiesEXTArray(toolCountSecondCall);
+
+               result = context.getInstanceInterface().getPhysicalDeviceToolPropertiesEXT(context.getPhysicalDevice(), &toolCountSecondCall, &deviceToolPropertiesEXTArray[0]);
+
+               if (result != VK_INCOMPLETE)
+               {
+                       testLog << tcu::TestLog::Message << "getPhysicalDeviceToolPropertiesEXT wrong result code" << tcu::TestLog::EndMessage;
+                       return tcu::TestStatus::fail("Fail");
+               }
+
+               if (toolCountSecondCall != (toolCount / 2))
+               {
+                       testLog << tcu::TestLog::Message << "Smaller array causes an error" << tcu::TestLog::EndMessage;
+                       return tcu::TestStatus::fail("Fail");
+               }
+       }
+
+       return tcu::TestStatus::pass("Pass");
+}
+
+tcu::TestStatus validateToolsProperties (Context& context)
+{
+       tcu::TestLog& testLog = context.getTestContext().getLog();
+
+       bool     result         = true;
+       deUint32 toolCount      = 0;
+
+       VK_CHECK(context.getInstanceInterface().getPhysicalDeviceToolPropertiesEXT(context.getPhysicalDevice(), &toolCount, DE_NULL));
+
+       if (toolCount > 0)
+       {
+               std::vector<VkPhysicalDeviceToolPropertiesEXT>  deviceToolPropertiesEXTArray(toolCount);
+
+               VK_CHECK(context.getInstanceInterface().getPhysicalDeviceToolPropertiesEXT(context.getPhysicalDevice(), &toolCount, &deviceToolPropertiesEXTArray[0]));
+
+               for (deUint32 i = 0; i < toolCount; ++i)
+               {
+                       size_t nameSize         = strnlen(deviceToolPropertiesEXTArray[i].name, VK_MAX_EXTENSION_NAME_SIZE);
+                       size_t versionSize      = strnlen(deviceToolPropertiesEXTArray[i].version, VK_MAX_EXTENSION_NAME_SIZE);
+                       size_t descSize         = strnlen(deviceToolPropertiesEXTArray[i].description, VK_MAX_DESCRIPTION_SIZE);
+                       size_t layerSize        = strnlen(deviceToolPropertiesEXTArray[i].layer, VK_MAX_EXTENSION_NAME_SIZE);
+
+                       result = result && (deviceToolPropertiesEXTArray[i].sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES_EXT);
+                       result = result && validateToolPurposeFlagBits(deviceToolPropertiesEXTArray[i].purposes);
+                       result = result && ((nameSize > 0)              && (nameSize < VK_MAX_EXTENSION_NAME_SIZE));
+                       result = result && ((versionSize > 0)   && (versionSize < VK_MAX_EXTENSION_NAME_SIZE));
+                       result = result && ((descSize > 0)              && (descSize < VK_MAX_DESCRIPTION_SIZE));
+                       result = result && ((layerSize == 0)    || (layerSize < VK_MAX_EXTENSION_NAME_SIZE));
+
+                       if (result == false)
+                       {
+                               testLog << tcu::TestLog::Message << "Tool validation failed" << tcu::TestLog::EndMessage;
+                               testLog << tcu::TestLog::Message << "Tool name: " << deviceToolPropertiesEXTArray[i].name << tcu::TestLog::EndMessage;
+                               testLog << tcu::TestLog::Message << "Version: " << deviceToolPropertiesEXTArray[i].version << tcu::TestLog::EndMessage;
+                               testLog << tcu::TestLog::Message << "Description: " << deviceToolPropertiesEXTArray[i].description << tcu::TestLog::EndMessage;
+                               testLog << tcu::TestLog::Message << "Purposes: " << getToolPurposeFlagsEXTStr(deviceToolPropertiesEXTArray[i].purposes) << tcu::TestLog::EndMessage;
+                               if (layerSize > 0)
+                               {
+                                       testLog << tcu::TestLog::Message << "Corresponding Layer: " << deviceToolPropertiesEXTArray[i].layer << tcu::TestLog::EndMessage;
+                               }
+
+                               break;
+                       }
+               }
+       }
+
+       if (result)
+       {
+               return tcu::TestStatus::pass("Pass");
+       }
+       else
+       {
+               return tcu::TestStatus::fail("Fail");
+       }
+}
+
+void createTestCases (tcu::TestCaseGroup* group)
+{
+       addFunctionCase(group, "validate_getter", "Validate getPhysicalDeviceToolPropertiesEXT", checkSupport, validateGetter);
+       addFunctionCase(group, "validate_tools_properties","Validate tools properties", checkSupport, validateToolsProperties);
+}
+
+} // anonymous
+
+tcu::TestCaseGroup*    createToolingInfoTests(tcu::TestContext& testCtx)
+{
+       return createTestGroup(testCtx, "tooling_info", "VK_EXT_tooling_info tests", createTestCases);
+}
+
+} // api
+} // vkt
diff --git a/external/vulkancts/modules/vulkan/api/vktApiToolingInfoTests.hpp b/external/vulkancts/modules/vulkan/api/vktApiToolingInfoTests.hpp
new file mode 100644 (file)
index 0000000..6c993d7
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _VKTAPITOOLINGINFOTESTS_HPP
+#define _VKTAPITOOLINGINFOTESTS_HPP
+/*-------------------------------------------------------------------------
+ * Vulkan Conformance Tests
+ * ------------------------
+ *
+ * Copyright (c) 2019 Advanced Micro Devices, Inc.
+ * Copyright (c) 2019 The Khronos Group Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ *//*!
+ * \file
+ * \brief VK_EXT_tooling_info tests
+ *//*--------------------------------------------------------------------*/
+
+#include "tcuDefs.hpp"
+#include "tcuTestCase.hpp"
+
+namespace vkt
+{
+namespace api
+{
+
+tcu::TestCaseGroup*    createToolingInfoTests  (tcu::TestContext& testCtx);
+
+} // api
+} // vkt
+
+#endif // _VKTAPITOOLINGINFOTESTS_HPP
index dd92f37..d4f517d 100644 (file)
@@ -114199,6 +114199,8 @@ dEQP-VK.api.pipeline.renderpass.framebuffer_compatible_renderpass
 dEQP-VK.api.pipeline.pipeline_layout.lifetime.graphics
 dEQP-VK.api.pipeline.pipeline_layout.lifetime.compute
 dEQP-VK.api.invariance.random
+dEQP-VK.api.tooling_info.validate_getter
+dEQP-VK.api.tooling_info.validate_tools_properties
 dEQP-VK.memory.allocation.basic.size_64.forward.count_1
 dEQP-VK.memory.allocation.basic.size_64.forward.count_10
 dEQP-VK.memory.allocation.basic.size_64.forward.count_100
index da81730..41baab5 100644 (file)
@@ -114199,6 +114199,8 @@ dEQP-VK.api.pipeline.renderpass.framebuffer_compatible_renderpass
 dEQP-VK.api.pipeline.pipeline_layout.lifetime.graphics
 dEQP-VK.api.pipeline.pipeline_layout.lifetime.compute
 dEQP-VK.api.invariance.random
+dEQP-VK.api.tooling_info.validate_getter
+dEQP-VK.api.tooling_info.validate_tools_properties
 dEQP-VK.memory.allocation.basic.size_64.forward.count_1
 dEQP-VK.memory.allocation.basic.size_64.forward.count_10
 dEQP-VK.memory.allocation.basic.size_64.forward.count_100