Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/vkd3d_shader_main.c:
allocator->current->next = next;
allocator->current = next;
allocator->index = 0;
- }
- params = &allocator->current->param[allocator->index * allocator->stride];
- allocator->index += count;
- return params;
+}
+bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve) +{
- memset(instructions, 0, sizeof(*instructions));
- /* Size the parameter initial allocations so they are large enough for most shaders. */
- return shader_instruction_array_reserve(instructions, reserve)
&& shader_param_allocator_init(&instructions->dst_params, reserve - reserve / 8u, sizeof(*instructions->elements->dst))
That's a completely minor thing, but maybe you can use just `reserve` here. The different with `reserve - reserve / 8u` shouldn't be that important, and, even with the comment, using such a specific expression leaves the reader asking what they're missing IMHO.