From acc9d79fbb112642518f25d2b9046e7f5264d42a Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Mon, 17 Jun 2024 16:42:11 -0500 Subject: [PATCH] vkd3d-shader/hlsl: Only allocate the aligned size for uniforms. --- libs/vkd3d-shader/hlsl_codegen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 09066a61..36270b15 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -4188,8 +4188,10 @@ static struct hlsl_reg allocate_numeric_registers_for_type(struct hlsl_ctx *ctx, { unsigned int reg_size = type->reg_size[HLSL_REGSET_NUMERIC]; + /* FIXME: We could potentially pack structs or arrays more efficiently... */ + if (type->class <= HLSL_CLASS_VECTOR) - return allocate_register(ctx, allocator, first_write, last_read, reg_size, type->dimx); + return allocate_register(ctx, allocator, first_write, last_read, type->dimx, type->dimx); else return allocate_range(ctx, allocator, first_write, last_read, reg_size); }