From: Giovanni Mascellani Subject: [PATCH vkd3d v3 2/7] vkd3d-shader/hlsl: Allocate enough space for temporary matrices. Message-Id: <20220602140609.3419134-2-gmascellani@codeweavers.com> Date: Thu, 2 Jun 2022 16:06:04 +0200 In-Reply-To: <20220602140609.3419134-1-gmascellani@codeweavers.com> References: <20220602140609.3419134-1-gmascellani@codeweavers.com> Signed-off-by: Giovanni Mascellani Signed-off-by: Francisco Casas Signed-off-by: Zebediah Figura --- If this is reverted on top of "Lower numeric casts", then the shader runner crashes with: shader_runner: ../vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h:1165: vkd3d_write_mask_component_count: Assertion `1 <= count && count <= VKD3D_VEC4_SIZE' failed. While the HLSL copiler is expected to output correct programs, the DXBC parser should not crash on malformed inputs anyway, so there is a bug to be fixed there too. v2: * Use hlsl_type_component_count() --- libs/vkd3d-shader/hlsl_codegen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index 78b22910..e38660af 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -1348,7 +1348,7 @@ static void allocate_variable_temp_register(struct hlsl_ctx *ctx, struct hlsl_ir var->last_read, var->data_type->reg_size); else var->reg = allocate_register(ctx, liveness, var->first_write, - var->last_read, var->data_type->dimx); + var->last_read, hlsl_type_component_count(var->data_type)); TRACE("Allocated %s to %s (liveness %u-%u).\n", var->name, debug_register('r', var->reg, var->data_type), var->first_write, var->last_read); } -- 2.36.1