VideoCommon: Fix padding in shader UIDs - #14795
Conversation
b39b348 to
ccfd97d
Compare
|
Conflicts with #14789 and #14791 (and #14792), sorry I should have tagged you in those.
Yeah, I encountered that in both my PRs too, I actually made it worse before noticing by using even more enums.
We absolutely want to do something. After thinking about this for several days (and several attempted fixes) I think the best solution is drop the relevant enums down to u8/u16. t's not part of the documented API, but I'm pretty sure we can just pass u32 as a fourth parameter to |
It's not part of the documented API, but searching for |
I tried, and there's currently a static_assert that complains. We could delete it though. |
|
No, you have to do it the other way around. See my PRs |
Looks like over time, shader UIDs' padding bits have gotten completely desynced from where padding bits actually exist / are needed.
This redoes all the padding to match reality, rearranges a few fields to reduce padding where possible, and adds some static_asserts reminding people to look back at the padding if they add things.
BTW, at least according to compiler explorer (and to be verified by CI as it runs), only GCC/Clang let you use
#pragma pack(1)to make structs smaller than their contained types (e.g.struct { u32 blah : 8 }being 1 byte instead of 4), so currently, VS UIDs are smaller on unix than Windows. Do we want to do anything about this? I changedpostMtxInfoto useu8s to avoid this, buttexMtxInfocontains enums that are defined as: u32.