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));
}