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.