vkd3d-shader/hlsl: Don't set "allocated" for unused reserved variables.

This commit is contained in:
Zebediah Figura 2023-06-21 12:21:19 -05:00 committed by Alexandre Julliard
parent 1c1f1094a5
commit d6ac823dd6
Notes: Alexandre Julliard 2023-06-22 22:04:01 +02:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/244
2 changed files with 7 additions and 8 deletions

View File

@ -2710,11 +2710,10 @@ static void allocate_register_reservations(struct hlsl_ctx *ctx)
type_string->buffer, get_regset_name(regset)); type_string->buffer, get_regset_name(regset));
hlsl_release_string_buffer(ctx, type_string); hlsl_release_string_buffer(ctx, type_string);
} }
else else if (var->regs[regset].bind_count)
{ {
var->regs[regset].allocated = true; var->regs[regset].allocated = true;
var->regs[regset].id = var->reg_reservation.reg_index; var->regs[regset].id = var->reg_reservation.reg_index;
var->regs[regset].bind_count = var->data_type->reg_size[regset];
TRACE("Allocated reserved %s to %c%u-%c%u.\n", var->name, var->reg_reservation.reg_type, TRACE("Allocated reserved %s to %c%u-%c%u.\n", var->name, var->reg_reservation.reg_type,
var->reg_reservation.reg_index, var->reg_reservation.reg_type, var->reg_reservation.reg_index, var->reg_reservation.reg_type,
var->reg_reservation.reg_index + var->regs[regset].bind_count); var->reg_reservation.reg_index + var->regs[regset].bind_count);
@ -4124,10 +4123,10 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
if (TRACE_ON()) if (TRACE_ON())
rb_for_each_entry(&ctx->functions, dump_function, ctx); rb_for_each_entry(&ctx->functions, dump_function, ctx);
allocate_register_reservations(ctx);
calculate_resource_register_counts(ctx); calculate_resource_register_counts(ctx);
allocate_register_reservations(ctx);
allocate_temp_registers(ctx, entry_func); allocate_temp_registers(ctx, entry_func);
if (profile->major_version < 4) if (profile->major_version < 4)
{ {

View File

@ -114,7 +114,7 @@ probe all rgba (4.0, 4.0, 4.0, 99.0)
% Overlapping reservations, both overlapping objects are unused. % Overlapping reservations, both overlapping objects are unused.
[pixel shader todo] [pixel shader]
Texture2D tex1 : register(t0); Texture2D tex1 : register(t0);
Texture2D tex2 : register(t0); Texture2D tex2 : register(t0);
Texture2D tex3; Texture2D tex3;
@ -125,12 +125,12 @@ float4 main() : sv_target
} }
[test] [test]
todo draw quad draw quad
probe all rgba (1.0, 1.0, 1.0, 99.0) probe all rgba (1.0, 1.0, 1.0, 99.0)
% Overlapping reservations % Overlapping reservations
[pixel shader todo] [pixel shader]
Texture2D tex1 : register(t2); Texture2D tex1 : register(t2);
Texture2D tex2 : register(t2); Texture2D tex2 : register(t2);
@ -140,5 +140,5 @@ float4 main() : sv_target
} }
[test] [test]
todo draw quad draw quad
probe all rgba (2.0, 2.0, 2.0, 99.0) probe all rgba (2.0, 2.0, 2.0, 99.0)