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:
@@ -85,14 +85,15 @@ emit_vertex_input(struct anv_pipeline *pipeline,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t elem_count = __builtin_popcount(elements) + needs_svgs_elem;
|
uint32_t elem_count = __builtin_popcount(elements) + needs_svgs_elem;
|
||||||
|
if (elem_count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
if (elem_count > 0) {
|
|
||||||
const uint32_t num_dwords = 1 + elem_count * 2;
|
const uint32_t num_dwords = 1 + elem_count * 2;
|
||||||
p = anv_batch_emitn(&pipeline->batch, num_dwords,
|
p = anv_batch_emitn(&pipeline->batch, num_dwords,
|
||||||
GENX(3DSTATE_VERTEX_ELEMENTS));
|
GENX(3DSTATE_VERTEX_ELEMENTS));
|
||||||
memset(p + 1, 0, (num_dwords - 1) * 4);
|
memset(p + 1, 0, (num_dwords - 1) * 4);
|
||||||
}
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < info->vertexAttributeDescriptionCount; i++) {
|
for (uint32_t i = 0; i < info->vertexAttributeDescriptionCount; i++) {
|
||||||
const VkVertexInputAttributeDescription *desc =
|
const VkVertexInputAttributeDescription *desc =
|
||||||
|
Reference in New Issue
Block a user