On Tue Jan 24 18:51:54 2023 +0000, Zebediah Figura wrote:
Hmm, do we definitely want to split the variables? We don't have to split up the hlsl_ir_var just to write it as multiple variables in the RDEF section. On the other hand, it lets a variable only have one regset. But if a variable can only have one regset, do we really need the bulk of this patch series?
Sorry, I made an inaccuracy in my explanation:
In later patches, the promotion of each object component to a separated variable will only be done at the beginning of `hlsl_sm4_write()` for SM5 so. before that, the variables are still tied together.
I probably got confused because my memory is bad and I was promoting components much sooner in previous versions of this patch series, but that didn't work (because component usage must be tracked at the variable level for the correct allocation of registers).
So the correct answer would be:
HLSL_REGSET_NUM is just expected to be retrieved as a fallback for structs, because the callers either only work with derefs to simple types (after struct copies have been lowered), or perform a recursive search through a variable's type and check for ```c (hlsl_type_get_regset(ctx, type) <= HLSL_REGSET_LAST_OBJECT) ``` base cases.
Maybe I should include an `HLSL_REGSET_UNDETERMINED` enum value for structs?