Fix crash in asserts with VK_EXT_vertex_input_dynamic_state

Assertions that there are no flags in
VkPipelineVertexInputStateCreateInfo did not account for the fact the
pointer may be nullptr if vertex input state is dynamic.

Test: dEQP-VK.draw.dynamic_rendering.primary_cmd_buff.instanced.dynamic_state_draw_*
Change-Id: Idb17beca9513e57822be95783b53b21d969d85a7
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/73188
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Commit-Queue: Shahbaz Youssefi <syoussefi@google.com>
Presubmit-Ready: Shahbaz Youssefi <syoussefi@google.com>
Tested-by: Shahbaz Youssefi <syoussefi@google.com>
diff --git a/src/Device/Context.cpp b/src/Device/Context.cpp
index 1cecc19..71c6811 100644
--- a/src/Device/Context.cpp
+++ b/src/Device/Context.cpp
@@ -315,12 +315,6 @@
 
 void Inputs::initialize(const VkPipelineVertexInputStateCreateInfo *vertexInputState, const VkPipelineDynamicStateCreateInfo *dynamicStateCreateInfo)
 {
-	if(vertexInputState->flags != 0)
-	{
-		// Vulkan 1.2: "flags is reserved for future use." "flags must be 0"
-		UNSUPPORTED("vertexInputState->flags");
-	}
-
 	dynamicStateFlags = ParseInputsDynamicStateFlags(dynamicStateCreateInfo);
 
 	if(dynamicStateFlags.dynamicVertexInput)
@@ -328,6 +322,12 @@
 		return;
 	}
 
+	if(vertexInputState->flags != 0)
+	{
+		// Vulkan 1.2: "flags is reserved for future use." "flags must be 0"
+		UNSUPPORTED("vertexInputState->flags");
+	}
+
 	// Temporary in-binding-order representation of buffer strides, to be consumed below
 	// when considering attributes. TODO: unfuse buffers from attributes in backend, is old GL model.
 	uint32_t vertexStrides[MAX_VERTEX_INPUT_BINDINGS];
@@ -513,7 +513,7 @@
 {
 	dynamicStateFlags = allDynamicStateFlags.vertexInputInterface;
 
-	if(vertexInputState->flags != 0)
+	if(vertexInputState && vertexInputState->flags != 0)
 	{
 		// Vulkan 1.2: "flags is reserved for future use." "flags must be 0"
 		UNSUPPORTED("vertexInputState->flags");