From: Nikolay Sivov nsivov@codeweavers.com
Otherwise we always output "dcl_temps 1" even when no temp registers were used. --- libs/vkd3d-shader/hlsl_codegen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 7d17ca8ce..46f07e1a6 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -3208,7 +3208,7 @@ struct register_allocator { size_t count, capacity;
- /* Highest register index that has been allocated. + /* Highest register index that has been allocated, plus one. * Used to declare sm4 temp count. */ uint32_t max_reg;
@@ -3260,7 +3260,7 @@ static void record_allocation(struct hlsl_ctx *ctx, struct register_allocator *a allocation->first_write = first_write; allocation->last_read = last_read;
- allocator->max_reg = max(allocator->max_reg, reg_idx); + allocator->max_reg = max(allocator->max_reg, reg_idx + 1); }
/* reg_size is the number of register components to be reserved, while component_count is the number @@ -3691,7 +3691,7 @@ static void allocate_temp_registers(struct hlsl_ctx *ctx, struct hlsl_ir_functio }
allocate_temp_registers_recurse(ctx, &entry_func->body, &allocator); - ctx->temp_count = allocator.max_reg + 1; + ctx->temp_count = allocator.max_reg; vkd3d_free(allocator.allocations); }