vkd3d-shader/hlsl: Only allocate numeric bind count for SM1 numeric uniforms.

Unless they have register reservations, in which case the whole
variable is still reserved.
This commit is contained in:
Francisco Casas 2024-05-03 02:06:37 -04:00 committed by Alexandre Julliard
parent 573d511344
commit f548644222
Notes: Alexandre Julliard 2024-05-13 22:57:39 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/851
2 changed files with 5 additions and 6 deletions

View File

@ -4593,15 +4593,14 @@ static void allocate_const_registers(struct hlsl_ctx *ctx, struct hlsl_ir_functi
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
{
unsigned int reg_size = var->data_type->reg_size[HLSL_REGSET_NUMERIC];
unsigned int alloc_size = 4 * var->bind_count[HLSL_REGSET_NUMERIC];
if (!var->is_uniform || !var->last_read || reg_size == 0)
if (!var->is_uniform || alloc_size == 0)
continue;
if (!var->regs[HLSL_REGSET_NUMERIC].allocated)
{
var->regs[HLSL_REGSET_NUMERIC] = allocate_numeric_registers_for_type(ctx, &allocator,
1, UINT_MAX, var->data_type);
var->regs[HLSL_REGSET_NUMERIC] = allocate_range(ctx, &allocator, 1, UINT_MAX, alloc_size);
TRACE("Allocated %s to %s.\n", var->name,
debug_register('c', var->regs[HLSL_REGSET_NUMERIC], var->data_type));
}

View File

@ -26,7 +26,7 @@ float4 main() : sv_target
uniform 0 float4 1 2 3 4
uniform 4 float4 100 200 300 400
draw quad
todo probe all rgba (101, 202, 303, 404)
probe all rgba (101, 202, 303, 404)
[pixel shader]
@ -188,7 +188,7 @@ uniform 16 float4 41 42 43 44
uniform 20 float4 51 52 53 54
uniform 24 float4 61 62 63 64
draw quad
todo probe all rgba (31, 52, 61, 62)
probe all rgba (31, 52, 61, 62)
[pixel shader]