Provoking vertex fixes

A few things were buggy in the last provoking vertex cl:
- There were 2 separate loops for rasterizationState extensions.
  Correctly combined them into a single loop.
- There was a missing break statement in vkCreateDevice
- There was a missing case in vkGetPhysicalDeviceFeatures2

Bug: angleproject:3677, angleproject:3430
Change-Id: Id4a16168933fc8c440b7339851a39e8cc4683491
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/37688
Presubmit-Ready: Alexis Hétu <sugoi@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/VkPipeline.cpp b/src/Vulkan/VkPipeline.cpp
index d75b7f8..cbb79c7 100644
--- a/src/Vulkan/VkPipeline.cpp
+++ b/src/Vulkan/VkPipeline.cpp
@@ -390,31 +390,6 @@
 		UNIMPLEMENTED("pCreateInfo->pRasterizationState settings");
 	}
 
-	if(rasterizationState->pNext)
-	{
-		const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(rasterizationState->pNext);
-		while(extensionCreateInfo)
-		{
-			// Casting to a long since some structures, such as
-			// VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT
-			// are not enumerated in the official Vulkan header
-			switch((long)(extensionCreateInfo->sType))
-			{
-			case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT:
-			{
-				const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT* provokingVertexModeCreateInfo =
-					reinterpret_cast<const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT*>(extensionCreateInfo);
-				context.provokingVertexMode = provokingVertexModeCreateInfo->provokingVertexMode;
-			}
-			break;
-			default:
-				UNIMPLEMENTED("extensionCreateInfo->pNext");
-			}
-
-			extensionCreateInfo = extensionCreateInfo->pNext;
-		}
-	}
-
 	context.rasterizerDiscard = (rasterizationState->rasterizerDiscardEnable == VK_TRUE);
 	context.cullMode = rasterizationState->cullMode;
 	context.frontFace = rasterizationState->frontFace;
@@ -425,7 +400,10 @@
 	const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(rasterizationState->pNext);
 	while(extensionCreateInfo)
 	{
-		switch(extensionCreateInfo->sType)
+		// Casting to a long since some structures, such as
+		// VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT
+		// are not enumerated in the official Vulkan header
+		switch((long)(extensionCreateInfo->sType))
 		{
 		case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT:
 		{
@@ -433,6 +411,13 @@
 			context.lineRasterizationMode = lineStateCreateInfo->lineRasterizationMode;
 		}
 		break;
+		case VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT:
+		{
+			const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT* provokingVertexModeCreateInfo =
+				reinterpret_cast<const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT*>(extensionCreateInfo);
+			context.provokingVertexMode = provokingVertexModeCreateInfo->provokingVertexMode;
+		}
+		break;
 		default:
 			UNIMPLEMENTED("extensionCreateInfo->sType");
 			break;
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp
index 84c16c2..025aa7e 100644
--- a/src/Vulkan/libVulkan.cpp
+++ b/src/Vulkan/libVulkan.cpp
@@ -611,6 +611,7 @@
 				// that the provokingVertexLast feature is enabled before using the provoking vertex convention.
 				(void)provokingVertexFeatures->provokingVertexLast;
 			}
+			break;
 		default:
 			// "the [driver] must skip over, without processing (other than reading the sType and pNext members) any structures in the chain with sType values not defined by [supported extenions]"
 			UNIMPLEMENTED("extensionCreateInfo->sType %d", int(extensionCreateInfo->sType));   // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here.
@@ -2371,7 +2372,7 @@
 	VkBaseOutStructure* extensionFeatures = reinterpret_cast<VkBaseOutStructure*>(pFeatures->pNext);
 	while(extensionFeatures)
 	{
-		switch(extensionFeatures->sType)
+		switch((long)(extensionFeatures->sType))
 		{
 		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES:
 			{
@@ -2421,6 +2422,16 @@
 				vk::Cast(physicalDevice)->getFeatures(&features);
 			}
 			break;
+		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT:
+			{
+				const VkPhysicalDeviceProvokingVertexFeaturesEXT* provokingVertexFeatures = reinterpret_cast<const VkPhysicalDeviceProvokingVertexFeaturesEXT*>(extensionFeatures);
+
+				// Provoking vertex is supported.
+				// provokingVertexFeatures->provokingVertexLast can be VK_TRUE or VK_FALSE.
+				// No action needs to be taken on our end in either case; it's the apps responsibility to check
+				// that the provokingVertexLast feature is enabled before using the provoking vertex convention.
+				(void)provokingVertexFeatures->provokingVertexLast;
+			}
 		case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT:
 			ASSERT(!HasExtensionProperty(VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME, deviceExtensionProperties,
 										 sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0])));