From 079e989b8e7eb4eea6d6d8cf6abddbd3d0d1274c Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Sat, 19 Jul 2025 22:40:16 +0200 Subject: [PATCH] vkd3d-shader/ir: Update the program TEMP count when allocating TEMP registers. --- libs/vkd3d-shader/ir.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index 97442c067..eea570fb4 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -8725,12 +8725,16 @@ enum vkd3d_result vsir_allocate_temp_registers(struct vsir_program *program, for (unsigned int i = 0; i < program->ssa_count; ++i) { const struct liveness_tracker_reg *liveness_reg = &tracker.ssa_regs[i]; + const unsigned int prev_temp_count = program->temp_count; struct temp_allocator_reg *reg = &allocator.ssa_regs[i]; - if (temp_allocator_allocate(&allocator, &tracker, reg, liveness_reg, program->temp_count)) + if (temp_allocator_allocate(&allocator, &tracker, reg, liveness_reg, prev_temp_count)) + { TRACE("Allocated r%u%s to sr%u (liveness %u-%u).\n", reg->temp_id, debug_vsir_writemask(reg->allocated_mask), i, liveness_reg->first_write, liveness_reg->last_access); + program->temp_count = max(program->temp_count, reg->temp_id + 1); + } ++allocator.allocated_ssa_count; } @@ -8789,10 +8793,7 @@ enum vkd3d_result vsir_allocate_temp_registers(struct vsir_program *program, for (unsigned int j = 0; j < ins->dst_count; ++j) { if (ins->dst[j].reg.type == VKD3DSPR_TEMP) - { temp_count = max(temp_count, ins->dst[j].reg.idx[0].offset + 1); - program->temp_count = max(program->temp_count, temp_count); - } } }