summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-02-14 14:17:08 -0800
committerKristian Høgsberg Kristensen <[email protected]>2016-02-15 17:32:07 -0800
commit53eaa0a6b8486ff82e7d2e68c3d491866ad5a12f (patch)
tree0a35f075b51f4c45c4241018fecb3480d97568d8
parent5d72d7b12d623c86539c807ea07f2e0bdc32836d (diff)
anv: Fix warning 3DSTATE_VERTEX_ELEMENTS setup
This is a little more subtle. If elem_count is 0, nothing else happens in this function, so we return early to avoid warning about uninitialized 'p'.
-rw-r--r--src/vulkan/genX_pipeline_util.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/vulkan/genX_pipeline_util.h b/src/vulkan/genX_pipeline_util.h
index 077281d2f56..696e2be7c3f 100644
--- a/src/vulkan/genX_pipeline_util.h
+++ b/src/vulkan/genX_pipeline_util.h
@@ -85,14 +85,15 @@ emit_vertex_input(struct anv_pipeline *pipeline,
#endif
uint32_t elem_count = __builtin_popcount(elements) + needs_svgs_elem;
+ if (elem_count == 0)
+ return;
uint32_t *p;
- if (elem_count > 0) {
- const uint32_t num_dwords = 1 + elem_count * 2;
- p = anv_batch_emitn(&pipeline->batch, num_dwords,
- GENX(3DSTATE_VERTEX_ELEMENTS));
- memset(p + 1, 0, (num_dwords - 1) * 4);
- }
+
+ const uint32_t num_dwords = 1 + elem_count * 2;
+ p = anv_batch_emitn(&pipeline->batch, num_dwords,
+ GENX(3DSTATE_VERTEX_ELEMENTS));
+ memset(p + 1, 0, (num_dwords - 1) * 4);
for (uint32_t i = 0; i < info->vertexAttributeDescriptionCount; i++) {
const VkVertexInputAttributeDescription *desc =