On Tue Jan 31 21:28:48 2023 +0000, Zebediah Figura wrote:
What does it mean that "register allocation still considers variables as a whole"? Why can't we get the same effect from just allocating the separate variables (assuming we do it in a consistent order)?
In the same example above, the `uniform struct apple ap` is allocated from `t0` to `t5` and from `s0` to `s2`, even though only `ap.sam2[0]` and `ap.texs2[1]` are used. Which means that all the register for `ap.texs1[]` and `ap.sam1[]` were allocated even if they are not used.
The rules are that for each variable, all texture registers are allocated if only one is used, and sampler registers are allocated from the first one to the last one that is actually used. These rules work at the variable-level, without considering how the variable is subdivided into components.