[PATCH vkd3d v2 07/10] vkd3d-shader/hlsl: Allocate enough space for temporary matrices.

Zebediah Figura zfigura at codeweavers.com
Thu May 12 18:10:04 CDT 2022


On 5/10/22 08:08, Giovanni Mascellani wrote:
> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
> ---
> 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.
> ---
>   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..5fdcd4dc 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, var->data_type->reg_size);
>           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);
>       }

This uses more storage than necessary for e.g. sm1 scalars, though. I 
think we can use hlsl_type_component_count() instead.

(All of the RA logic desperately needs to be rewritten, but oh well...)



More information about the wine-devel mailing list