On Fri Nov 10 02:48:40 2023 +0000, Zebediah Figura wrote:
It'd be nice to have tests for mixing register and non-register allocations, e.g. to make sure that precedence and overlapping works as expected.
Well, `register(cX)` only has effect on the `$Globals` constant buffer and `packoffset()` cannot be used on it (because the variable must be inside a `cbuffer` declaration).
I added a test that checks that `register(cX)` has no effect inside a cbuffer: ```hlsl cbuffer c { float4 a : packoffset(c1); float4 b : packoffset(c2) : register(c1); // ^ register(c1) ignored for cbuffer that is not $Globals. }
float4 main() : sv_target { return a + b; } ``` Note that the packoffset(cX) is required on the second field because if one cbuffer member uses packoffset() all others must.
However, this would still be a todo since currently don't support multiple register() or packoffset() declarations in the same variable, we would have to modify the parser and vectorize the `reservation` field, but I didn't think this was something to worry about yet.