I'm not sure this is great either. For example, it's legal to write "float1x1 a : packoffset(c2.x)" [although, interestingly, not c2.y!]
You are right. I am surprised that is the case! It doesn't make much sense since automatic packing doesn't respect this restriction, e.g. : ```hlsl cbuffer buffer { float1x1 a; // packed into c0.x float1x1 b; // packed into c0.y } ``` Perhaps it is an over-generalization since larger matrices should be aligned. v2 already covers arrays and structs, but not these small matrices.
Fixed it in v3.
We probably should explicitly test those two as well.
Right, I also added tests with `: packoffset (c0.y)` for structs and arrays.
Perhaps we should just have two conditions (which are probably going to be necessary in the code), along the lines of "packoffset() reservations with vector types cannot span multiple registers" and "packoffset() reservations with matrix/array/struct types cannot specify a component". [I'd also say 'component' rather than 'swizzle' honestly.]
Okay, I added an error message for each type.
The last suggestion for error message would be a little imprecise since they can indeed specify a component, as long as it is `.x`. So I wrote: ``` "packoffset() reservations with matrix/array/struct types must be aligned with the beginning of a register." ``` in v3.