Conor McCarthy (@cmccarthy) commented about libs/vkd3d-shader/ir.c:
+static enum vkd3d_result simple_structurizer_run(struct vkd3d_shader_parser *parser) +{ + const unsigned int block_temp_idx = parser->program.temp_count; + struct vkd3d_shader_instruction *instructions = NULL; + const struct vkd3d_shader_location no_loc = {0}; + size_t ins_capacity = 0, ins_count = 0, i; + bool first_label_found = false; + + if (!reserve_instructions(&instructions, &ins_capacity, parser->program.instructions.count)) + goto fail; + + for (i = 0; i < parser->program.instructions.count; ++i) + { + struct vkd3d_shader_instruction *ins = &parser->program.instructions.elements[i]; + + if (!reserve_instructions(&instructions, &ins_capacity, ins_count + 1)) This can go in the default case. All other cases make their own reservations.
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/607#note_59804