demos/cube: Provide a non-null VertexInputStateCreateInfo
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 16 Oct 2015 00:15:25 +0000 (17:15 -0700)
committerCourtney Goeltzenleuchter <courtney@LunarG.com>
Wed, 28 Oct 2015 21:36:59 +0000 (15:36 -0600)
In the spec for VkGraphicsPipelineCreateInfo, some structs are explicitly
listed as being able to be NULL if they are not used.
VertexInputStateCreateInfo is not one of them.

demos/cube.c

index d2c20d0..ea53f49 100644 (file)
@@ -1539,6 +1539,7 @@ static void demo_prepare_pipeline(struct demo *demo)
 {
     VkGraphicsPipelineCreateInfo pipeline;
     VkPipelineCacheCreateInfo pipelineCache;
+    VkPipelineVertexInputStateCreateInfo   vi;
     VkPipelineInputAssemblyStateCreateInfo ia;
     VkPipelineRasterStateCreateInfo        rs;
     VkPipelineColorBlendStateCreateInfo    cb;
@@ -1558,6 +1559,9 @@ static void demo_prepare_pipeline(struct demo *demo)
     pipeline.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
     pipeline.layout = demo->pipeline_layout;
 
+    memset(&vi, 0, sizeof(vi));
+    vi.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
+
     memset(&ia, 0, sizeof(ia));
     ia.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
     ia.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
@@ -1623,7 +1627,7 @@ static void demo_prepare_pipeline(struct demo *demo)
     err = vkCreatePipelineCache(demo->device, &pipelineCache, &demo->pipelineCache);
     assert(!err);
 
-    pipeline.pVertexInputState   = NULL;
+    pipeline.pVertexInputState   = &vi;
     pipeline.pInputAssemblyState = &ia;
     pipeline.pRasterState        = &rs;
     pipeline.pColorBlendState    = &cb;