Zebediah Figura (@zfigura) commented about libs/vkd3d-shader/hlsl_codegen.c:
/* register offsets shouldn't be used before this point is reached. */ assert(!deref->offset.node);
- type = hlsl_deref_get_type(ctx, deref);
- /* Instruction that directly refer to structs and arrays (instead of single-register componets)
* are removed later by dce. So it is not a problem to consider them numerics for computing
* offsets. */
- deref->offset_regset = HLSL_REGSET_NUMERIC;
- if (hlsl_type_is_resource(type))
deref->offset_regset = hlsl_type_get_regset(ctx, type);
I'm not a fan of this for clarity. I'd rather guard out the offset_regset assignment by checking if the type is a struct (or array?) and then just leave it undefined otherwise. [I know this is kind of what you were trying to achieve with HLSL_REGSET_VOID, but I still am inclined to say that's not worth existing.]
I can live with it on the grounds that this function is eventually going to go away, but I do want to push for actually moving forward on that. I don't want to litter the code with half-finished refactors; it's not the worst thing for maintenance but it's not great either.