return tcu::TestStatus::pass("Querying succeeded");
}
+tcu::TestStatus createDeviceWithPromoted11Structures (Context& context)
+{
+ if (!context.contextSupports(vk::ApiVersion(0, 1, 1, 0)))
+ TCU_THROW(NotSupportedError, "Vulkan 1.1 is not supported");
+
+ const PlatformInterface& platformInterface = context.getPlatformInterface();
+ const CustomInstance instance (createCustomInstanceFromContext(context));
+ const InstanceDriver& instanceDriver (instance.getDriver());
+ const VkPhysicalDevice physicalDevice = chooseDevice(instanceDriver, instance, context.getTestContext().getCommandLine());
+ const deUint32 queueFamilyIndex = 0;
+ const deUint32 queueCount = 1;
+ const deUint32 queueIndex = 0;
+ const float queuePriority = 1.0f;
+
+ const vector<VkQueueFamilyProperties> queueFamilyProperties = getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
+
+ const VkDeviceQueueCreateInfo deviceQueueCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
+ DE_NULL,
+ (VkDeviceQueueCreateFlags)0u,
+ queueFamilyIndex, //queueFamilyIndex;
+ queueCount, //queueCount;
+ &queuePriority, //pQueuePriorities;
+ };
+
+ VkPhysicalDeviceMultiviewFeaturesKHR deviceMultiviewFeatures = initVulkanStructure();
+ VkPhysicalDevice16BitStorageFeaturesKHR device16BitStorageFeatures = initVulkanStructure(&deviceMultiviewFeatures);
+ VkPhysicalDeviceVariablePointerFeaturesKHR deviceVariablePointersFeatures = initVulkanStructure(&device16BitStorageFeatures);
+ VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR deviceSamplerYcbcrConversionFeatures = initVulkanStructure(&deviceVariablePointersFeatures);
+ VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&deviceSamplerYcbcrConversionFeatures);
+
+ instanceDriver.getPhysicalDeviceFeatures2 (physicalDevice, &extFeatures);
+
+ const VkDeviceCreateInfo deviceCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType;
+ &extFeatures, //pNext;
+ (VkDeviceCreateFlags)0u,
+ 1, //queueRecordCount;
+ &deviceQueueCreateInfo, //pRequestedQueues;
+ 0, //layerCount;
+ DE_NULL, //ppEnabledLayerNames;
+ 0, //extensionCount;
+ DE_NULL, //ppEnabledExtensionNames;
+ DE_NULL, //pEnabledFeatures;
+ };
+
+ const Unique<VkDevice> device (createCustomDevice(context.getTestContext().getCommandLine().isValidationEnabled(), platformInterface, instance, instanceDriver, physicalDevice, &deviceCreateInfo));
+ const DeviceDriver deviceDriver (platformInterface, instance, device.get());
+ const VkQueue queue = getDeviceQueue(deviceDriver, *device, queueFamilyIndex, queueIndex);
+
+ VK_CHECK(deviceDriver.queueWaitIdle(queue));
+
+ return tcu::TestStatus::pass("Pass");
+}
+
+tcu::TestStatus createDeviceWithPromoted12Structures (Context& context)
+{
+ if (!context.contextSupports(vk::ApiVersion(0, 1, 2, 0)))
+ TCU_THROW(NotSupportedError, "Vulkan 1.2 is not supported");
+
+ const PlatformInterface& platformInterface = context.getPlatformInterface();
+ const CustomInstance instance (createCustomInstanceFromContext(context));
+ const InstanceDriver& instanceDriver (instance.getDriver());
+ const VkPhysicalDevice physicalDevice = chooseDevice(instanceDriver, instance, context.getTestContext().getCommandLine());
+ const deUint32 queueFamilyIndex = 0;
+ const deUint32 queueCount = 1;
+ const deUint32 queueIndex = 0;
+ const float queuePriority = 1.0f;
+
+ const vector<VkQueueFamilyProperties> queueFamilyProperties = getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
+
+ const VkDeviceQueueCreateInfo deviceQueueCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
+ DE_NULL,
+ (VkDeviceQueueCreateFlags)0u,
+ queueFamilyIndex, //queueFamilyIndex;
+ queueCount, //queueCount;
+ &queuePriority, //pQueuePriorities;
+ };
+
+ VkPhysicalDeviceShaderFloat16Int8FeaturesKHR deviceShaderFloat16Int8Features = initVulkanStructure();
+ VkPhysicalDeviceImagelessFramebufferFeaturesKHR deviceImagelessFramebufferFeatures = initVulkanStructure(&deviceShaderFloat16Int8Features);
+ VkPhysicalDeviceDescriptorIndexingFeaturesEXT deviceDescriptorIndexingFeatures = initVulkanStructure(&deviceImagelessFramebufferFeatures);
+ VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR deviceShaderSubgroupExtendedTypesFeatures = initVulkanStructure(&deviceDescriptorIndexingFeatures);
+ VkPhysicalDevice8BitStorageFeaturesKHR device8BitStorageFeatures = initVulkanStructure(&deviceShaderSubgroupExtendedTypesFeatures);
+ VkPhysicalDeviceShaderAtomicInt64FeaturesKHR deviceShaderAtomicInt64Features = initVulkanStructure(&device8BitStorageFeatures);
+ VkPhysicalDeviceTimelineSemaphoreFeaturesKHR deviceTimelineSemaphoreFeatures = initVulkanStructure(&deviceShaderAtomicInt64Features);
+ VkPhysicalDeviceVulkanMemoryModelFeaturesKHR deviceVulkanMemoryModelFeatures = initVulkanStructure(&deviceTimelineSemaphoreFeatures);
+ VkPhysicalDeviceScalarBlockLayoutFeaturesEXT deviceScalarBlockLayoutFeatures = initVulkanStructure(&deviceVulkanMemoryModelFeatures);
+ VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR deviceSeparateDepthStencilLayoutsFeatures = initVulkanStructure(&deviceScalarBlockLayoutFeatures);
+ VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR deviceUniformBufferStandardLayoutFeatures = initVulkanStructure(&deviceSeparateDepthStencilLayoutsFeatures);
+ VkPhysicalDeviceBufferDeviceAddressFeaturesKHR deviceBufferDeviceAddressFeatures = initVulkanStructure(&deviceUniformBufferStandardLayoutFeatures);
+ VkPhysicalDeviceHostQueryResetFeaturesEXT deviceHostQueryResetFeatures = initVulkanStructure(&deviceBufferDeviceAddressFeatures);
+ VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&deviceHostQueryResetFeatures);
+
+ instanceDriver.getPhysicalDeviceFeatures2 (physicalDevice, &extFeatures);
+
+ const VkDeviceCreateInfo deviceCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType;
+ &extFeatures, //pNext;
+ (VkDeviceCreateFlags)0u,
+ 1, //queueRecordCount;
+ &deviceQueueCreateInfo, //pRequestedQueues;
+ 0, //layerCount;
+ DE_NULL, //ppEnabledLayerNames;
+ 0, //extensionCount;
+ DE_NULL, //ppEnabledExtensionNames;
+ DE_NULL, //pEnabledFeatures;
+ };
+
+ const Unique<VkDevice> device (createCustomDevice(context.getTestContext().getCommandLine().isValidationEnabled(), platformInterface, instance, instanceDriver, physicalDevice, &deviceCreateInfo));
+ const DeviceDriver deviceDriver (platformInterface, instance, device.get());
+ const VkQueue queue = getDeviceQueue(deviceDriver, *device, queueFamilyIndex, queueIndex);
+
+ VK_CHECK(deviceDriver.queueWaitIdle(queue));
+
+ return tcu::TestStatus::pass("Pass");
+}
+
+tcu::TestStatus createDeviceWithPromoted13Structures (Context& context)
+{
+ if (!context.contextSupports(vk::ApiVersion(0, 1, 3, 0)))
+ TCU_THROW(NotSupportedError, "Vulkan 1.3 is not supported");
+
+ const PlatformInterface& platformInterface = context.getPlatformInterface();
+ const CustomInstance instance (createCustomInstanceFromContext(context));
+ const InstanceDriver& instanceDriver (instance.getDriver());
+ const VkPhysicalDevice physicalDevice = chooseDevice(instanceDriver, instance, context.getTestContext().getCommandLine());
+ const deUint32 queueFamilyIndex = 0;
+ const deUint32 queueCount = 1;
+ const deUint32 queueIndex = 0;
+ const float queuePriority = 1.0f;
+
+ const vector<VkQueueFamilyProperties> queueFamilyProperties = getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
+
+ const VkDeviceQueueCreateInfo deviceQueueCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
+ DE_NULL,
+ (VkDeviceQueueCreateFlags)0u,
+ queueFamilyIndex, //queueFamilyIndex;
+ queueCount, //queueCount;
+ &queuePriority, //pQueuePriorities;
+ };
+
+ VkPhysicalDeviceDynamicRenderingFeaturesKHR deviceDynamicRenderingFeatures = initVulkanStructure();
+ VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT deviceTextureCompressionASTCHDRFeatures = initVulkanStructure(&deviceDynamicRenderingFeatures);
+ VkPhysicalDeviceInlineUniformBlockFeaturesEXT deviceInlineUniformBlockFeatures = initVulkanStructure(&deviceTextureCompressionASTCHDRFeatures);
+ VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR deviceShaderTerminateInvocationFeatures = initVulkanStructure(&deviceInlineUniformBlockFeatures);
+ VkPhysicalDeviceSubgroupSizeControlFeaturesEXT deviceSubgroupSizeControlFeatures = initVulkanStructure(&deviceShaderTerminateInvocationFeatures);
+ VkPhysicalDeviceExtendedDynamicStateFeaturesEXT deviceExtendedDynamicStateFeaturesEXT = initVulkanStructure(&deviceSubgroupSizeControlFeatures);
+ VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT deviceShaderDemoteToHelperInvocationFeatures = initVulkanStructure(&deviceExtendedDynamicStateFeaturesEXT);
+ VkPhysicalDeviceShaderIntegerDotProductFeaturesKHR deviceShaderIntegerDotProductFeatures = initVulkanStructure(&deviceShaderDemoteToHelperInvocationFeatures);
+ VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT deviceTexelBufferAlignmentFeaturesEXT = initVulkanStructure(&deviceShaderIntegerDotProductFeatures);
+ VkPhysicalDevicePrivateDataFeaturesEXT devicePrivateDataFeatures = initVulkanStructure(&deviceTexelBufferAlignmentFeaturesEXT);
+ VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT devicePipelineCreationCacheControlFeatures = initVulkanStructure(&devicePrivateDataFeatures);
+ VkPhysicalDeviceSynchronization2FeaturesKHR deviceSynchronization2Features = initVulkanStructure(&devicePipelineCreationCacheControlFeatures);
+ VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR deviceZeroInitializeWorkgroupMemoryFeatures = initVulkanStructure(&deviceSynchronization2Features);
+ VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT deviceYcbcr2Plane444FormatsFeaturesEXT = initVulkanStructure(&deviceZeroInitializeWorkgroupMemoryFeatures);
+ VkPhysicalDeviceImageRobustnessFeaturesEXT deviceImageRobustnessFeatures = initVulkanStructure(&deviceYcbcr2Plane444FormatsFeaturesEXT);
+ VkPhysicalDevice4444FormatsFeaturesEXT device4444FormatsFeaturesEXT = initVulkanStructure(&deviceImageRobustnessFeatures);
+ VkPhysicalDeviceExtendedDynamicState2FeaturesEXT deviceExtendedDynamicState2FeaturesEXT = initVulkanStructure(&device4444FormatsFeaturesEXT);
+ VkPhysicalDeviceMaintenance4FeaturesKHR deviceMaintenance4Features = initVulkanStructure(&deviceExtendedDynamicState2FeaturesEXT);
+ VkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&deviceMaintenance4Features);
+
+ instanceDriver.getPhysicalDeviceFeatures2 (physicalDevice, &extFeatures);
+
+ const VkDeviceCreateInfo deviceCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType;
+ &extFeatures, //pNext;
+ (VkDeviceCreateFlags)0u,
+ 1, //queueRecordCount;
+ &deviceQueueCreateInfo, //pRequestedQueues;
+ 0, //layerCount;
+ DE_NULL, //ppEnabledLayerNames;
+ 0, //extensionCount;
+ DE_NULL, //ppEnabledExtensionNames;
+ DE_NULL, //pEnabledFeatures;
+ };
+
+ const Unique<VkDevice> device (createCustomDevice(context.getTestContext().getCommandLine().isValidationEnabled(), platformInterface, instance, instanceDriver, physicalDevice, &deviceCreateInfo));
+ const DeviceDriver deviceDriver (platformInterface, instance, device.get());
+ const VkQueue queue = getDeviceQueue(deviceDriver, *device, queueFamilyIndex, queueIndex);
+
+ VK_CHECK(deviceDriver.queueWaitIdle(queue));
+
+ return tcu::TestStatus::pass("Pass");
+}
+
void addSeparateFeatureTests (tcu::TestCaseGroup* testGroup)
{
addFunctionCase(testGroup, "private_data_features", "VkPhysicalDevicePrivateDataFeatures", testPhysicalDeviceFeaturePrivateDataFeatures);
addFunctionCase(testGroup, "depth_clamp_zero_one_features_ext", "VkPhysicalDeviceDepthClampZeroOneFeaturesEXT", testPhysicalDeviceFeatureDepthClampZeroOneFeaturesEXT);
addFunctionCase(testGroup, "address_binding_report_features_ext", "VkPhysicalDeviceAddressBindingReportFeaturesEXT", testPhysicalDeviceFeatureAddressBindingReportFeaturesEXT);
addFunctionCase(testGroup, "fault_features_ext", "VkPhysicalDeviceFaultFeaturesEXT", testPhysicalDeviceFeatureFaultFeaturesEXT);
+ addFunctionCase(testGroup, "create_device_with_promoted11_structures", "", createDeviceWithPromoted11Structures);
+ addFunctionCase(testGroup, "create_device_with_promoted12_structures", "", createDeviceWithPromoted12Structures);
+ addFunctionCase(testGroup, "create_device_with_promoted13_structures", "", createDeviceWithPromoted13Structures);
}
stream.append('\treturn tcu::TestStatus::pass("Querying succeeded");')
stream.append("}\n")
+ allApiVersions = [f.number for f in api.features]
+ promotedTests = []
+ for version in allApiVersions:
+ major = version[0]
+ minor = version[-1]
+ promotedFeatures = []
+ for ext in api.extensions:
+ if ext.promotedto == "VK_VERSION_" + version.replace('.', '_'):
+ for req in ext.requirementsList:
+ for type in req.newTypes:
+ matchedStructType = re.search(f'VkPhysicalDevice(\w+)Features(\w+)', type.name, re.IGNORECASE)
+ if matchedStructType:
+ promotedFeatures.append(type)
+ break
+
+ if promotedFeatures:
+ testName = "createDeviceWithPromoted" + version.replace('.', '') + "Structures"
+ promotedTests.append(testName)
+ stream.append("tcu::TestStatus " + testName + " (Context& context)")
+ stream.append("{")
+ stream.append(
+ ' if (!context.contextSupports(vk::ApiVersion(0, ' + major + ', ' + minor + ', 0)))\n'
+ ' TCU_THROW(NotSupportedError, "Vulkan ' + major + '.' + minor + ' is not supported");')
+ stream.append("""
+ const PlatformInterface& platformInterface = context.getPlatformInterface();
+ const CustomInstance instance (createCustomInstanceFromContext(context));
+ const InstanceDriver& instanceDriver (instance.getDriver());
+ const VkPhysicalDevice physicalDevice = chooseDevice(instanceDriver, instance, context.getTestContext().getCommandLine());
+ const deUint32 queueFamilyIndex = 0;
+ const deUint32 queueCount = 1;
+ const deUint32 queueIndex = 0;
+ const float queuePriority = 1.0f;
+
+ const vector<VkQueueFamilyProperties> queueFamilyProperties = getPhysicalDeviceQueueFamilyProperties(instanceDriver, physicalDevice);
+
+ const VkDeviceQueueCreateInfo deviceQueueCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
+ DE_NULL,
+ (VkDeviceQueueCreateFlags)0u,
+ queueFamilyIndex, //queueFamilyIndex;
+ queueCount, //queueCount;
+ &queuePriority, //pQueuePriorities;
+ };
+""")
+ lastFeature = ''
+ for feature in promotedFeatures:
+ for struct in testedStructureDetail:
+ if feature.name in struct.nameList:
+ if lastFeature:
+ stream.append("\t" + feature.name + " " + struct.instanceName + " = initVulkanStructure(&" + lastFeature + ");")
+ else:
+ stream.append("\t" + feature.name + " " + struct.instanceName + " = initVulkanStructure();")
+ lastFeature = struct.instanceName
+ break
+ stream.append("\tVkPhysicalDeviceFeatures2 extFeatures = initVulkanStructure(&" + lastFeature + ");")
+ stream.append("""
+ instanceDriver.getPhysicalDeviceFeatures2 (physicalDevice, &extFeatures);
+
+ const VkDeviceCreateInfo deviceCreateInfo =
+ {
+ VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, //sType;
+ &extFeatures, //pNext;
+ (VkDeviceCreateFlags)0u,
+ 1, //queueRecordCount;
+ &deviceQueueCreateInfo, //pRequestedQueues;
+ 0, //layerCount;
+ DE_NULL, //ppEnabledLayerNames;
+ 0, //extensionCount;
+ DE_NULL, //ppEnabledExtensionNames;
+ DE_NULL, //pEnabledFeatures;
+ };
+
+ const Unique<VkDevice> device (createCustomDevice(context.getTestContext().getCommandLine().isValidationEnabled(), platformInterface, instance, instanceDriver, physicalDevice, &deviceCreateInfo));
+ const DeviceDriver deviceDriver (platformInterface, instance, device.get());
+ const VkQueue queue = getDeviceQueue(deviceDriver, *device, queueFamilyIndex, queueIndex);
+
+ VK_CHECK(deviceDriver.queueWaitIdle(queue));
+
+ return tcu::TestStatus::pass("Pass");
+}
+""")
+
# function to create tests
stream.append("void addSeparateFeatureTests (tcu::TestCaseGroup* testGroup)\n{")
for x in testedStructureDetail:
stream.append('\taddFunctionCase(testGroup, "' + camelToSnake(x.instanceName[len('device'):]) + '", "' + x.nameList[0] + '", testPhysicalDeviceFeature' + x.instanceName[len('device'):] + ');')
+ for x in promotedTests:
+ stream.append('\taddFunctionCase(testGroup, "' + camelToSnake(x) + '", "", ' + x + ');')
stream.append('}\n')
# write out