Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/tpf.c:
for (i = 0; i < component_count; ++i)
{
struct hlsl_type *component_type = hlsl_type_get_component_type(ctx, var->data_type, i);
struct hlsl_ir_var *new_var;
struct hlsl_ir_node *instr;
enum hlsl_regset regset;
if (!hlsl_type_is_resource(component_type))
continue;
regset = hlsl_type_get_regset(component_type);
if (offsets[regset] > var->regs[regset].bind_count)
continue;
if (var->objects_usage[regset][offsets[regset]].used)
See, this logic is complicated, and it makes me think I was right to say that this information should be tracked per-component.
Either way I feel like what we want is some helper that translates a component index to its register set + offset.