- Can the component be a "matrix" swizzle (_11 or _m00, etc.)?
Not according to documentation. I also just tested it in native and doesn't work. I added a couple of tests.
- Can we test that it's legal (if ignored) to put packoffset on a resource?
I added a commit with additional tests. For textures it is legal, but also forces other fields to have manual offset packing. For samplers, it can be used but a `register()` is also required at the same time (and SM1 behavior is different: packoffset() is allowed alone, but cannot be used together with other non-resource fields, which seems like a bug). For now, I think it is better to be permissive and make them follow the same less-restrictive rules of textures in this regard.
- Can we have tests that show packoffset is ignored for sm1? Also, how many of the errors implemented in these patches should apply to sm1?
Since behavior is different between SM1 and SM4, we would `[require]` something like `shader model < 4.0`, and repeat the tests. Or perhaps something like `[test sm1]` tags?
I did some testing. I conclude that, in SM1: - The contents of packoffset() are subject to very little checks: `: packoffset(u.sPoNgEbOb);` compiles (but, weirdly enough, not `: packoffset(sPoNgEbOb);`. For now, I would just ignore the value and be permissive, I added a simple patch for that. - The "packoffset() is only allowed inside constant buffer declarations." still apply. - The other introduced error checks aren't checked for in SM1.
- Brief tests suggest that it's actually fine to mix packoffset numeric constants with objects that have register() but not packoffset() in the same buffer. We should probably test that and get it right; it wouldn't surprise me if that one in particular is actually used.
Oh! Good observation. I added tests and a small patch to allow this.
Also, what happens when you apply `packoffset()` to a nested structure, or a nested structure field?
Good point. I added some tests for this. It seems that I was missing throwing an error when packoffset() is used inside struct fields.