From: Chad Versace Date: Fri, 28 Aug 2015 15:07:15 +0000 (-0700) Subject: vk/pipeline: Fix crash when the pipeline has no attributes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=84cfc08c1059f6190b0ada811003abe93c624e39;p=mesa.git vk/pipeline: Fix crash when the pipeline has no attributes If there are no attributes, don't emit 3DSTATE_VERTEX_ELEMENTS. That packet does not allow 0 attributes. --- diff --git a/src/vulkan/gen7_pipeline.c b/src/vulkan/gen7_pipeline.c index a5c7a201690..0ed4727c37f 100644 --- a/src/vulkan/gen7_pipeline.c +++ b/src/vulkan/gen7_pipeline.c @@ -39,8 +39,10 @@ gen7_emit_vertex_input(struct anv_pipeline *pipeline, const uint32_t num_dwords = 1 + element_count * 2; uint32_t *p; - p = anv_batch_emitn(&pipeline->batch, num_dwords, - GEN7_3DSTATE_VERTEX_ELEMENTS); + if (info->attributeCount > 0) { + p = anv_batch_emitn(&pipeline->batch, num_dwords, + GEN7_3DSTATE_VERTEX_ELEMENTS); + } for (uint32_t i = 0; i < info->attributeCount; i++) { const VkVertexInputAttributeDescription *desc = diff --git a/src/vulkan/gen8_pipeline.c b/src/vulkan/gen8_pipeline.c index b1cb16234d5..fae09f3fbbe 100644 --- a/src/vulkan/gen8_pipeline.c +++ b/src/vulkan/gen8_pipeline.c @@ -36,8 +36,10 @@ emit_vertex_input(struct anv_pipeline *pipeline, const uint32_t num_dwords = 1 + info->attributeCount * 2; uint32_t *p; - p = anv_batch_emitn(&pipeline->batch, num_dwords, - GEN8_3DSTATE_VERTEX_ELEMENTS); + if (info->attributeCount > 0) { + p = anv_batch_emitn(&pipeline->batch, num_dwords, + GEN8_3DSTATE_VERTEX_ELEMENTS); + } for (uint32_t i = 0; i < info->attributeCount; i++) { const VkVertexInputAttributeDescription *desc =