vkd3d-shader/ir: Record the previous temp count before allocating any SSA values.

Due to the unintentional placement of this line, we were inadvertently
allocating every SSA value to a unique temp register, overflowing limits.
This commit is contained in:
Elizabeth Figura
2025-07-29 16:35:55 -05:00
committed by Henri Verbeet
parent 67fd9bb76b
commit 75cb4336ec
Notes: Henri Verbeet 2025-07-30 16:00:28 +02:00
Approved-by: Francisco Casas (@fcasas)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1664

View File

@@ -8751,6 +8751,7 @@ 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)
{ {
const unsigned int prev_temp_count = program->temp_count;
struct temp_allocator allocator = {0}; struct temp_allocator allocator = {0};
struct temp_allocator_reg *regs; struct temp_allocator_reg *regs;
struct liveness_tracker tracker; struct liveness_tracker tracker;
@@ -8773,7 +8774,6 @@ 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, prev_temp_count)) if (temp_allocator_allocate(&allocator, &tracker, reg, liveness_reg, prev_temp_count))