Yep, you are totally right, I should have left this change in the previous commit when I split the patch. Good catch!
On 19-07-22 05:25, Giovanni Mascellani wrote:
Hi,
Il 15/07/22 03:23, Francisco Casas ha scritto:
@@ -1732,32 +1715,30 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct list *instrs, struct hlsl_ir_var *dst, unsigned int *store_index, struct hlsl_ir_node *src) { unsigned int src_comp_count = hlsl_type_component_count(src->data_type); + struct hlsl_deref dst_deref; unsigned int k; + hlsl_init_simple_deref_from_var(&dst_deref, dst);
for (k = 0; k < src_comp_count; ++k) { struct hlsl_type *dst_comp_type; - unsigned int dst_reg_offset; struct hlsl_ir_store *store; - struct hlsl_ir_constant *c; struct hlsl_ir_load *load; struct hlsl_ir_node *conv; + struct hlsl_block block; if (!(load = add_load_component(ctx, instrs, src, k, &src->loc))) return; - dst_reg_offset = hlsl_compute_component_offset(ctx, dst->data_type, *store_index, &dst_comp_type); + dst_comp_type = hlsl_type_get_component_type(ctx, dst->data_type, *store_index); if (!(conv = add_implicit_conversion(ctx, instrs, &load->node, dst_comp_type, &src->loc))) return; - if (!(c = hlsl_new_uint_constant(ctx, dst_reg_offset, &src->loc))) + if (!(store = hlsl_new_store_component(ctx, &block, &dst_deref, *store_index, conv))) return; - list_add_tail(instrs, &c->node.entry);
- if (!(store = hlsl_new_store(ctx, dst, &c->node, conv, 0, src->loc))) - return; - list_add_tail(instrs, &store->node.entry); + list_move_tail(instrs, &block.instrs); ++*store_index; }
Here you are using hlsl_new_store_component(), which makes sense, so maybe these changes should belong to 11/17? Maybe I am blind, but I can't see how they depend on the changes in this patch.
Giovanni.