Fix for promoted physical device features struct

vkMandatoryFeatures.inl adding both KHR and EXT features struct
with same sType to check the feature supported for promoted extensions.
This change  fix VK_KHR_index_type_uint8, VK_KHR_line_rasterization and
VK_EXT_vertex_attribute_divisor extensions. The json file for extension
VK_EXT_vertex_attribute_divisor is added back with the fix.

Affects:
dEQP-VK.info.device_mandatory_features

Components: Vulkan

VK-GL-CTS issue: 5062

Change-Id: I9f593a8ce1324ab70b8e8e5384808012a73c6b6b
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/vulkan-cts/+/1096617
Reviewed-by: Craig Stout <cstout@google.com>
diff --git a/external/vulkancts/framework/vulkan/generated/vulkan/vkMandatoryFeatures.inl b/external/vulkancts/framework/vulkan/generated/vulkan/vkMandatoryFeatures.inl
index 260b81d..3a2d758 100644
--- a/external/vulkancts/framework/vulkan/generated/vulkan/vkMandatoryFeatures.inl
+++ b/external/vulkancts/framework/vulkan/generated/vulkan/vkMandatoryFeatures.inl
@@ -391,16 +391,6 @@
 		nextPtr  = &physicalDeviceImagelessFramebufferFeatures.pNext;
 	}
 
-	vk::VkPhysicalDeviceIndexTypeUint8FeaturesEXT physicalDeviceIndexTypeUint8FeaturesEXT;
-	deMemset(&physicalDeviceIndexTypeUint8FeaturesEXT, 0, sizeof(physicalDeviceIndexTypeUint8FeaturesEXT));
-
-	if ( canUseFeaturesStruct(deviceExtensions, usedApiVersion, "VK_EXT_index_type_uint8") || canUseFeaturesStruct(deviceExtensions, usedApiVersion, "VK_KHR_index_type_uint8") )
-	{
-		physicalDeviceIndexTypeUint8FeaturesEXT.sType = getStructureType<VkPhysicalDeviceIndexTypeUint8FeaturesEXT>();
-		*nextPtr = &physicalDeviceIndexTypeUint8FeaturesEXT;
-		nextPtr  = &physicalDeviceIndexTypeUint8FeaturesEXT.pNext;
-	}
-
 	vk::VkPhysicalDeviceIndexTypeUint8FeaturesKHR physicalDeviceIndexTypeUint8FeaturesKHR;
 	deMemset(&physicalDeviceIndexTypeUint8FeaturesKHR, 0, sizeof(physicalDeviceIndexTypeUint8FeaturesKHR));
 
@@ -431,16 +421,6 @@
 		nextPtr  = &physicalDeviceLegacyDitheringFeaturesEXT.pNext;
 	}
 
-	vk::VkPhysicalDeviceLineRasterizationFeaturesEXT physicalDeviceLineRasterizationFeaturesEXT;
-	deMemset(&physicalDeviceLineRasterizationFeaturesEXT, 0, sizeof(physicalDeviceLineRasterizationFeaturesEXT));
-
-	if ( canUseFeaturesStruct(deviceExtensions, usedApiVersion, "VK_EXT_line_rasterization") || canUseFeaturesStruct(deviceExtensions, usedApiVersion, "VK_KHR_line_rasterization") )
-	{
-		physicalDeviceLineRasterizationFeaturesEXT.sType = getStructureType<VkPhysicalDeviceLineRasterizationFeaturesEXT>();
-		*nextPtr = &physicalDeviceLineRasterizationFeaturesEXT;
-		nextPtr  = &physicalDeviceLineRasterizationFeaturesEXT.pNext;
-	}
-
 	vk::VkPhysicalDeviceLineRasterizationFeaturesKHR physicalDeviceLineRasterizationFeaturesKHR;
 	deMemset(&physicalDeviceLineRasterizationFeaturesKHR, 0, sizeof(physicalDeviceLineRasterizationFeaturesKHR));
 
@@ -1786,15 +1766,6 @@
 	}
 #endif // defined(CTS_USES_VULKAN)
 
-	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_index_type_uint8")) )
-	{
-		if ( physicalDeviceIndexTypeUint8FeaturesEXT.indexTypeUint8 == VK_FALSE )
-		{
-			log << tcu::TestLog::Message << "Mandatory feature indexTypeUint8 not supported" << tcu::TestLog::EndMessage;
-			result = false;
-		}
-	}
-
 	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_inline_uniform_block")) )
 	{
 		if ( physicalDeviceInlineUniformBlockFeaturesEXT.inlineUniformBlock == VK_FALSE )
@@ -1822,15 +1793,6 @@
 		}
 	}
 
-	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_line_rasterization")) )
-	{
-		if ( ( physicalDeviceLineRasterizationFeaturesEXT.rectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.bresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.smoothLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.stippledRectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.stippledBresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.stippledSmoothLines == VK_FALSE ) )
-		{
-			log << tcu::TestLog::Message << "Mandatory feature rectangularLines or bresenhamLines or smoothLines or stippledRectangularLines or stippledBresenhamLines or stippledSmoothLines not supported" << tcu::TestLog::EndMessage;
-			result = false;
-		}
-	}
-
 	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_memory_priority")) )
 	{
 		if ( physicalDeviceMemoryPriorityFeaturesEXT.memoryPriority == VK_FALSE )
@@ -2216,6 +2178,15 @@
 		}
 	}
 
+	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_index_type_uint8")) )
+	{
+		if ( physicalDeviceIndexTypeUint8FeaturesKHR.indexTypeUint8 == VK_FALSE )
+		{
+			log << tcu::TestLog::Message << "Mandatory feature indexTypeUint8 not supported" << tcu::TestLog::EndMessage;
+			result = false;
+		}
+	}
+
 	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_KHR_index_type_uint8")) )
 	{
 		if ( physicalDeviceIndexTypeUint8FeaturesKHR.indexTypeUint8 == VK_FALSE )
@@ -2225,6 +2196,15 @@
 		}
 	}
 
+	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_line_rasterization")) )
+	{
+		if ( ( physicalDeviceLineRasterizationFeaturesKHR.rectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.bresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.smoothLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledRectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledBresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledSmoothLines == VK_FALSE ) )
+		{
+			log << tcu::TestLog::Message << "Mandatory feature rectangularLines or bresenhamLines or smoothLines or stippledRectangularLines or stippledBresenhamLines or stippledSmoothLines not supported" << tcu::TestLog::EndMessage;
+			result = false;
+		}
+	}
+
 	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_KHR_line_rasterization")) )
 	{
 		if ( ( physicalDeviceLineRasterizationFeaturesKHR.rectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.bresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.smoothLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledRectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledBresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledSmoothLines == VK_FALSE ) )
@@ -2514,6 +2494,15 @@
 		}
 	}
 
+	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_vertex_attribute_divisor")) )
+	{
+		if ( physicalDeviceVertexAttributeDivisorFeaturesKHR.vertexAttributeInstanceRateDivisor == VK_FALSE )
+		{
+			log << tcu::TestLog::Message << "Mandatory feature vertexAttributeInstanceRateDivisor not supported" << tcu::TestLog::EndMessage;
+			result = false;
+		}
+	}
+
 	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_KHR_vertex_attribute_divisor")) )
 	{
 		if ( physicalDeviceVertexAttributeDivisorFeaturesKHR.vertexAttributeInstanceRateDivisor == VK_FALSE )
diff --git a/external/vulkancts/framework/vulkan/generated/vulkansc/vkMandatoryFeatures.inl b/external/vulkancts/framework/vulkan/generated/vulkansc/vkMandatoryFeatures.inl
index fb38893..30eaf25 100644
--- a/external/vulkancts/framework/vulkan/generated/vulkansc/vkMandatoryFeatures.inl
+++ b/external/vulkancts/framework/vulkan/generated/vulkansc/vkMandatoryFeatures.inl
@@ -141,16 +141,6 @@
 		nextPtr  = &physicalDeviceImagelessFramebufferFeatures.pNext;
 	}
 
-	vk::VkPhysicalDeviceIndexTypeUint8FeaturesEXT physicalDeviceIndexTypeUint8FeaturesEXT;
-	deMemset(&physicalDeviceIndexTypeUint8FeaturesEXT, 0, sizeof(physicalDeviceIndexTypeUint8FeaturesEXT));
-
-	if ( canUseFeaturesStruct(deviceExtensions, usedApiVersion, "VK_EXT_index_type_uint8") )
-	{
-		physicalDeviceIndexTypeUint8FeaturesEXT.sType = getStructureType<VkPhysicalDeviceIndexTypeUint8FeaturesEXT>();
-		*nextPtr = &physicalDeviceIndexTypeUint8FeaturesEXT;
-		nextPtr  = &physicalDeviceIndexTypeUint8FeaturesEXT.pNext;
-	}
-
 	vk::VkPhysicalDeviceIndexTypeUint8FeaturesKHR physicalDeviceIndexTypeUint8FeaturesKHR;
 	deMemset(&physicalDeviceIndexTypeUint8FeaturesKHR, 0, sizeof(physicalDeviceIndexTypeUint8FeaturesKHR));
 
@@ -161,16 +151,6 @@
 		nextPtr  = &physicalDeviceIndexTypeUint8FeaturesKHR.pNext;
 	}
 
-	vk::VkPhysicalDeviceLineRasterizationFeaturesEXT physicalDeviceLineRasterizationFeaturesEXT;
-	deMemset(&physicalDeviceLineRasterizationFeaturesEXT, 0, sizeof(physicalDeviceLineRasterizationFeaturesEXT));
-
-	if ( canUseFeaturesStruct(deviceExtensions, usedApiVersion, "VK_EXT_line_rasterization") )
-	{
-		physicalDeviceLineRasterizationFeaturesEXT.sType = getStructureType<VkPhysicalDeviceLineRasterizationFeaturesEXT>();
-		*nextPtr = &physicalDeviceLineRasterizationFeaturesEXT;
-		nextPtr  = &physicalDeviceLineRasterizationFeaturesEXT.pNext;
-	}
-
 	vk::VkPhysicalDeviceLineRasterizationFeaturesKHR physicalDeviceLineRasterizationFeaturesKHR;
 	deMemset(&physicalDeviceLineRasterizationFeaturesKHR, 0, sizeof(physicalDeviceLineRasterizationFeaturesKHR));
 
@@ -835,24 +815,6 @@
 		}
 	}
 
-	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_index_type_uint8")) )
-	{
-		if ( physicalDeviceIndexTypeUint8FeaturesEXT.indexTypeUint8 == VK_FALSE )
-		{
-			log << tcu::TestLog::Message << "Mandatory feature indexTypeUint8 not supported" << tcu::TestLog::EndMessage;
-			result = false;
-		}
-	}
-
-	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_line_rasterization")) )
-	{
-		if ( ( physicalDeviceLineRasterizationFeaturesEXT.rectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.bresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.smoothLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.stippledRectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.stippledBresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesEXT.stippledSmoothLines == VK_FALSE ) )
-		{
-			log << tcu::TestLog::Message << "Mandatory feature rectangularLines or bresenhamLines or smoothLines or stippledRectangularLines or stippledBresenhamLines or stippledSmoothLines not supported" << tcu::TestLog::EndMessage;
-			result = false;
-		}
-	}
-
 #if defined(CTS_USES_VULKAN)
 	if ( physicalDeviceMeshShaderFeaturesEXT.primitiveFragmentShadingRateMeshShader )
 	{
@@ -1035,6 +997,15 @@
 		}
 	}
 
+	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_index_type_uint8")) )
+	{
+		if ( physicalDeviceIndexTypeUint8FeaturesKHR.indexTypeUint8 == VK_FALSE )
+		{
+			log << tcu::TestLog::Message << "Mandatory feature indexTypeUint8 not supported" << tcu::TestLog::EndMessage;
+			result = false;
+		}
+	}
+
 	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_KHR_index_type_uint8")) )
 	{
 		if ( physicalDeviceIndexTypeUint8FeaturesKHR.indexTypeUint8 == VK_FALSE )
@@ -1044,6 +1015,15 @@
 		}
 	}
 
+	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_line_rasterization")) )
+	{
+		if ( ( physicalDeviceLineRasterizationFeaturesKHR.rectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.bresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.smoothLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledRectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledBresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledSmoothLines == VK_FALSE ) )
+		{
+			log << tcu::TestLog::Message << "Mandatory feature rectangularLines or bresenhamLines or smoothLines or stippledRectangularLines or stippledBresenhamLines or stippledSmoothLines not supported" << tcu::TestLog::EndMessage;
+			result = false;
+		}
+	}
+
 	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_KHR_line_rasterization")) )
 	{
 		if ( ( physicalDeviceLineRasterizationFeaturesKHR.rectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.bresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.smoothLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledRectangularLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledBresenhamLines == VK_FALSE ) && ( physicalDeviceLineRasterizationFeaturesKHR.stippledSmoothLines == VK_FALSE ) )
@@ -1172,6 +1152,15 @@
 		}
 	}
 
+	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_EXT_vertex_attribute_divisor")) )
+	{
+		if ( physicalDeviceVertexAttributeDivisorFeaturesKHR.vertexAttributeInstanceRateDivisor == VK_FALSE )
+		{
+			log << tcu::TestLog::Message << "Mandatory feature vertexAttributeInstanceRateDivisor not supported" << tcu::TestLog::EndMessage;
+			result = false;
+		}
+	}
+
 	if ( isExtensionStructSupported(deviceExtensions, RequiredExtension("VK_KHR_vertex_attribute_divisor")) )
 	{
 		if ( physicalDeviceVertexAttributeDivisorFeaturesKHR.vertexAttributeInstanceRateDivisor == VK_FALSE )
diff --git a/external/vulkancts/scripts/src/extensions/VK_EXT_index_type_uint8.json b/external/vulkancts/scripts/src/extensions/VK_EXT_index_type_uint8.json
index af6bbe4..eb459c7 100644
--- a/external/vulkancts/scripts/src/extensions/VK_EXT_index_type_uint8.json
+++ b/external/vulkancts/scripts/src/extensions/VK_EXT_index_type_uint8.json
@@ -1,9 +1,7 @@
 {
-	"mandatory_features":
+	"register_extension":
 	{
-		"VkPhysicalDeviceIndexTypeUint8FeaturesEXT":
-		[
-			{ "features": ["indexTypeUint8"],		"requirements": ["VK_EXT_index_type_uint8"] }
-		]
+		"type": "device",
+		"core": ""
 	}
 }
\ No newline at end of file
diff --git a/external/vulkancts/scripts/src/extensions/VK_EXT_line_rasterization.json b/external/vulkancts/scripts/src/extensions/VK_EXT_line_rasterization.json
index 014b9f5..eb459c7 100644
--- a/external/vulkancts/scripts/src/extensions/VK_EXT_line_rasterization.json
+++ b/external/vulkancts/scripts/src/extensions/VK_EXT_line_rasterization.json
@@ -1,9 +1,7 @@
 {
-	"mandatory_features":
+	"register_extension":
 	{
-		"VkPhysicalDeviceLineRasterizationFeaturesEXT":
-		[
-			{ "features": ["rectangularLines", "bresenhamLines", "smoothLines", "stippledRectangularLines", "stippledBresenhamLines", "stippledSmoothLines"],	"requirements": ["VK_EXT_line_rasterization"] }
-		]
+		"type": "device",
+		"core": ""
 	}
 }
\ No newline at end of file
diff --git a/external/vulkancts/scripts/src/extensions/VK_EXT_vertex_attribute_divisor.json b/external/vulkancts/scripts/src/extensions/VK_EXT_vertex_attribute_divisor.json
new file mode 100644
index 0000000..eb459c7
--- /dev/null
+++ b/external/vulkancts/scripts/src/extensions/VK_EXT_vertex_attribute_divisor.json
@@ -0,0 +1,7 @@
+{
+	"register_extension":
+	{
+		"type": "device",
+		"core": ""
+	}
+}
\ No newline at end of file
diff --git a/external/vulkancts/scripts/src/extensions/VK_KHR_index_type_uint8.json b/external/vulkancts/scripts/src/extensions/VK_KHR_index_type_uint8.json
index eb3dcb4..29a2f0a 100644
--- a/external/vulkancts/scripts/src/extensions/VK_KHR_index_type_uint8.json
+++ b/external/vulkancts/scripts/src/extensions/VK_KHR_index_type_uint8.json
@@ -8,6 +8,7 @@
 	{
 		"VkPhysicalDeviceIndexTypeUint8FeaturesKHR":
 		[
+			{ "features": ["indexTypeUint8"],		"requirements": ["VK_EXT_index_type_uint8"] },
 			{ "features": ["indexTypeUint8"],		"requirements": ["VK_KHR_index_type_uint8"] }
 		]
 	}
diff --git a/external/vulkancts/scripts/src/extensions/VK_KHR_line_rasterization.json b/external/vulkancts/scripts/src/extensions/VK_KHR_line_rasterization.json
index 09d4c35..d55bf33 100644
--- a/external/vulkancts/scripts/src/extensions/VK_KHR_line_rasterization.json
+++ b/external/vulkancts/scripts/src/extensions/VK_KHR_line_rasterization.json
@@ -8,6 +8,7 @@
 	{
 		"VkPhysicalDeviceLineRasterizationFeaturesKHR":
 		[
+			{ "features": ["rectangularLines", "bresenhamLines", "smoothLines", "stippledRectangularLines", "stippledBresenhamLines", "stippledSmoothLines"],	"requirements": ["VK_EXT_line_rasterization"] },
 			{ "features": ["rectangularLines", "bresenhamLines", "smoothLines", "stippledRectangularLines", "stippledBresenhamLines", "stippledSmoothLines"],	"requirements": ["VK_KHR_line_rasterization"] }
 		]
 	}
diff --git a/external/vulkancts/scripts/src/extensions/VK_KHR_vertex_attribute_divisor.json b/external/vulkancts/scripts/src/extensions/VK_KHR_vertex_attribute_divisor.json
index 30688d7..c5828b6 100644
--- a/external/vulkancts/scripts/src/extensions/VK_KHR_vertex_attribute_divisor.json
+++ b/external/vulkancts/scripts/src/extensions/VK_KHR_vertex_attribute_divisor.json
@@ -8,6 +8,7 @@
 	{
 		"VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR":
 		[
+			{ "features": ["vertexAttributeInstanceRateDivisor"],	"requirements": ["VK_EXT_vertex_attribute_divisor"] },
 			{ "features": ["vertexAttributeInstanceRateDivisor"],	"requirements": ["VK_KHR_vertex_attribute_divisor"] }
 		]
 	}