Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl_codegen.c:
+ for (i = 0; i < hlsl_type_element_count(type); ++i) + { + if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc))) + return; + list_add_after(&lhs->node.entry, &c->node.entry); + + if (!(load = hlsl_new_load_index(ctx, &lhs->src, &c->node, &var->loc))) + return; + list_add_after(&c->node.entry, &load->node.entry); + + if (element_type->class == HLSL_CLASS_STRUCT) + prepend_input_struct_copy(ctx, instrs, load); + else if (element_type->class == HLSL_CLASS_ARRAY) + prepend_input_array_copy(ctx, instrs, load, modifiers, semantic); + else + prepend_input_copy(ctx, instrs, load, modifiers, semantic); This pattern appears I think three times now, we should be able to use a helper. Or just fold this into the prologue of prepend_input_copy(), maybe?
-- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/148#note_29096