mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Avoid hlsl_type_get_regset() in allocate_register_reservations().
This commit is contained in:
parent
e64e08b2b7
commit
a214b7374b
Notes:
Alexandre Julliard
2023-10-05 22:36:55 +02:00
Approved-by: Giovanni Mascellani (@giomasce) 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/342
@ -2968,31 +2968,39 @@ static void allocate_register_reservations(struct hlsl_ctx *ctx)
|
|||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
|
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
|
||||||
{
|
{
|
||||||
enum hlsl_regset regset;
|
unsigned int r;
|
||||||
|
|
||||||
if (!hlsl_type_is_resource(var->data_type))
|
if (!hlsl_type_is_resource(var->data_type))
|
||||||
continue;
|
continue;
|
||||||
regset = hlsl_type_get_regset(var->data_type);
|
|
||||||
|
|
||||||
if (var->reg_reservation.reg_type && var->regs[regset].allocation_size)
|
if (var->reg_reservation.reg_type)
|
||||||
{
|
{
|
||||||
if (var->reg_reservation.reg_type != get_regset_name(regset))
|
for (r = 0; r <= HLSL_REGSET_LAST_OBJECT; ++r)
|
||||||
{
|
{
|
||||||
struct vkd3d_string_buffer *type_string;
|
if (var->regs[r].allocation_size > 0)
|
||||||
|
{
|
||||||
|
if (var->reg_reservation.reg_type != get_regset_name(r))
|
||||||
|
{
|
||||||
|
struct vkd3d_string_buffer *type_string;
|
||||||
|
|
||||||
type_string = hlsl_type_to_string(ctx, var->data_type);
|
/* We can throw this error because resources can only span across a single
|
||||||
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION,
|
* regset, but we have to check for multiple regsets if we support register
|
||||||
"Object of type '%s' must be bound to register type '%c'.",
|
* reservations for structs for SM5. */
|
||||||
type_string->buffer, get_regset_name(regset));
|
type_string = hlsl_type_to_string(ctx, var->data_type);
|
||||||
hlsl_release_string_buffer(ctx, type_string);
|
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION,
|
||||||
}
|
"Object of type '%s' must be bound to register type '%c'.",
|
||||||
else
|
type_string->buffer, get_regset_name(r));
|
||||||
{
|
hlsl_release_string_buffer(ctx, type_string);
|
||||||
var->regs[regset].allocated = true;
|
}
|
||||||
var->regs[regset].id = var->reg_reservation.reg_index;
|
else
|
||||||
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->regs[r].allocated = true;
|
||||||
var->reg_reservation.reg_index + var->regs[regset].allocation_size);
|
var->regs[r].id = var->reg_reservation.reg_index;
|
||||||
|
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->regs[r].allocation_size);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user