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'.
This commit is contained in:
Kristian Høgsberg Kristensen 2016-02-14 14:17:08 -08:00
parent 5d72d7b12d
commit 53eaa0a6b8
1 changed files with 7 additions and 6 deletions

View File

@ -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 =