vkd3d-shader/ir: Update the program TEMP count when allocating TEMP registers.

This commit is contained in:
Giovanni Mascellani
2025-07-19 22:40:16 +02:00
committed by Henri Verbeet
parent f5cd0b4a15
commit 079e989b8e
Notes: Henri Verbeet 2025-07-21 12:36:25 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1630

View File

@@ -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) for (unsigned int i = 0; i < program->ssa_count; ++i)
{ {
const struct liveness_tracker_reg *liveness_reg = &tracker.ssa_regs[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]; 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", TRACE("Allocated r%u%s to sr%u (liveness %u-%u).\n",
reg->temp_id, debug_vsir_writemask(reg->allocated_mask), i, reg->temp_id, debug_vsir_writemask(reg->allocated_mask), i,
liveness_reg->first_write, liveness_reg->last_access); liveness_reg->first_write, liveness_reg->last_access);
program->temp_count = max(program->temp_count, reg->temp_id + 1);
}
++allocator.allocated_ssa_count; ++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) for (unsigned int j = 0; j < ins->dst_count; ++j)
{ {
if (ins->dst[j].reg.type == VKD3DSPR_TEMP) if (ins->dst[j].reg.type == VKD3DSPR_TEMP)
{
temp_count = max(temp_count, ins->dst[j].reg.idx[0].offset + 1); temp_count = max(temp_count, ins->dst[j].reg.idx[0].offset + 1);
program->temp_count = max(program->temp_count, temp_count);
}
} }
} }