[PATCH vkd3d v3 11/11] vkd3d-shader/hlsl: Parse matrix constructors.

Giovanni Mascellani gmascellani at codeweavers.com
Fri Apr 22 05:51:53 CDT 2022


Hi,

Il 22/04/22 12:25, Giovanni Mascellani ha scritto:
> -        if (!(arg = add_implicit_conversion(ctx, params->instrs, arg,
> -                hlsl_get_vector_type(ctx, type->base_type, width), &arg->loc)))
> -            continue;
> +            src_offset = hlsl_compute_component_reg_offset(ctx, arg->data_type, j, &src_type, &arg->loc);
> +            dst_offset = hlsl_compute_component_reg_offset(ctx, type, idx, &dst_type, &arg->loc);
>   
> -        if (!(store = hlsl_new_store(ctx, var, NULL, arg,
> -                ((1u << width) - 1) << writemask_offset, arg->loc)))
> -            return NULL;
> -        list_add_tail(params->instrs, &store->node.entry);
> +            if (!(src_offset_const = hlsl_new_uint_constant(ctx, src_offset, &loc)))
> +                return NULL;
> +            list_add_tail(params->instrs, &src_offset_const->node.entry);
>   
> -        writemask_offset += width;
> +            if (!(dst_offset_const = hlsl_new_uint_constant(ctx, dst_offset, &loc)))
> +                return NULL;
> +            list_add_tail(params->instrs, &dst_offset_const->node.entry);
> +
> +            if (!(value = add_load(ctx, params->instrs, arg, &src_offset_const->node, src_type, loc)))
> +                return NULL;
> +
> +            if (!(converted = add_implicit_conversion(ctx, params->instrs, &value->node, dst_type, &arg->loc)))
> +                return NULL;
> +
> +            if (!(store = hlsl_new_store(ctx, var, &dst_offset_const->node, converted, 0, arg->loc)))
> +                return NULL;
> +            list_add_tail(params->instrs, &store->node.entry);
> +
> +            idx++;

I just realized that here I am basically reimplementing Francisco's 
initialize_var_components(). I should probably reuse that one instead.

Giovanni.



More information about the wine-devel mailing list