New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduced struct sizes using align for x64 platforms, fields carefully moved #19047
base: master
Are you sure you want to change the base?
Conversation
dd884dd
to
3c6932b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are good for things like the Vulkan/OpenGL structs.
However, when structs are used to define arrays like SamplerDef which are not accessed very often, I think clarity matters more than saving a few bytes.
So, I have marked a couple that I would like to be reverted.
const char* name; | ||
SamplerFlags flags; | ||
int binding; // Might only be used by some backends. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular one won't matter for performance, here I prefer the original order, looks better in the table using the struct later.
// branches | ||
u32 branchTarget; | ||
int branchRegisterNum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this one int down again, I liked having it next to isBranchToRegister. It's aligned with no waste anyway since it's after exactly four bools.
int* columnOrder; | ||
int columnCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is another one I'd prefer to revert because it makes the tables that use the struct look less nice.
Tested only on Debug
Before RAM util (master):
After RAM util (align-struct-64):