vkd3d-shader/ir: Use iterators in vsir_allocate_temp_registers().

This commit is contained in:
Francisco Casas
2025-08-06 12:10:00 -04:00
committed by Henri Verbeet
parent 687a4ab243
commit e3fe2cec07
Notes: Henri Verbeet 2025-08-21 16:35:05 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1675

View File

@@ -8828,8 +8828,10 @@ static void temp_allocator_set_dst(struct temp_allocator *allocator,
enum vkd3d_result vsir_allocate_temp_registers(struct vsir_program *program, enum vkd3d_result vsir_allocate_temp_registers(struct vsir_program *program,
struct vkd3d_shader_message_context *message_context) struct vkd3d_shader_message_context *message_context)
{ {
struct vsir_program_iterator it = vsir_program_iterator(&program->instructions);
const unsigned int prev_temp_count = program->temp_count; const unsigned int prev_temp_count = program->temp_count;
struct temp_allocator allocator = {0}; struct temp_allocator allocator = {0};
struct vkd3d_shader_instruction *ins;
struct temp_allocator_reg *regs; struct temp_allocator_reg *regs;
struct liveness_tracker tracker; struct liveness_tracker tracker;
enum vkd3d_result ret; enum vkd3d_result ret;
@@ -8863,10 +8865,8 @@ enum vkd3d_result vsir_allocate_temp_registers(struct vsir_program *program,
++allocator.allocated_ssa_count; ++allocator.allocated_ssa_count;
} }
for (unsigned int i = 0; i < program->instructions.count; ++i) for (ins = vsir_program_iterator_head(&it); ins; ins = vsir_program_iterator_next(&it))
{ {
const struct vkd3d_shader_instruction *ins = &program->instructions.elements[i];
/* Make sure we do the srcs first; setting the dst writemask may need /* Make sure we do the srcs first; setting the dst writemask may need
* to remap their swizzles. */ * to remap their swizzles. */
for (unsigned int j = 0; j < ins->src_count; ++j) for (unsigned int j = 0; j < ins->src_count; ++j)