[PATCH vkd3d 1/8] vkd3d-shader/hlsl: Detect missing loads on rhs when splitting copies of non-numeric types.

Zebediah Figura zfigura at codeweavers.com
Thu Apr 28 13:21:31 CDT 2022


On 4/28/22 08:31, Giovanni Mascellani wrote:
> From: Francisco Casas <fcasas at codeweavers.com>
> 
> Otherwise we can get failed assertions:
> assert(node->type == HLSL_IR_LOAD);
> because broadcasts to these types are not implemented yet.
> 
> Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
> Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> ---
>   libs/vkd3d-shader/hlsl_codegen.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 
> diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c
> index e945b94d..f7396a96 100644
> --- a/libs/vkd3d-shader/hlsl_codegen.c
> +++ b/libs/vkd3d-shader/hlsl_codegen.c
> @@ -637,6 +637,12 @@ static bool split_array_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
>       element_type = type->e.array.type;
>       element_size = hlsl_type_get_array_element_reg_size(element_type);
>   
> +    if (rhs->type != HLSL_IR_LOAD)
> +    {
> +        hlsl_fixme(ctx, &instr->loc, "Array store rhs is not HLSL_IR_LOAD. Broadcast may be missing.");
> +        return false;
> +    }
> +
>       for (i = 0; i < type->e.array.elements_count; ++i)
>       {
>           if (!split_copy(ctx, store, hlsl_ir_load(rhs), i * element_size, element_type))

In the future, though, I think we want to try to handle this in the 
place where we generate the invalid IR, if that's feasible. That makes 
it more inherently clear why we're generating invalid IR, and it also 
ensures we don't forget to remove the hlsl_fixme later. In this case I 
believe it'd be a matter of handling it for explicit and implicit casts.



More information about the wine-devel mailing list