-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Simplify buffer object creation #9436
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
base: main
Are you sure you want to change the base?
Conversation
Simplify the buffer object creation logic to streamline and help make the future integration of asynchronous features easier.
| auto shouldCreateBuffer = [this](size_t attributeIndex) { | ||
| if (mBufferObjectsEnabled) { | ||
| if (!mAdvancedSkinningEnabled) { | ||
| return false; |
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.
Although this is behaviorally identical to the original code, I'm not sure why we don't create a buffer in this case. @pixelflinger what do you think?
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.
I think it's because if mBufferObjectsEnabled is true, we don't manage the buffers, the user does. But there is an exception to that: If mAdvancedSkinningEnabled is true, then we need to manage the skinning/morphing buffers.
| if (mBufferObjectsEnabled) { | ||
| if (!mAdvancedSkinningEnabled) { |
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.
Looks like this case can be entirely taken outside the loop. I think that will make it even easier to read.
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.
So you mean if (!mAdvancedSkinningEnabled) always takes precedence over mBufferObjectsEnabled? It's a different behavior through, let me update this.
| auto shouldCreateBuffer = [this](size_t attributeIndex) { | ||
| if (mBufferObjectsEnabled) { | ||
| if (!mAdvancedSkinningEnabled) { | ||
| return false; |
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.
I think it's because if mBufferObjectsEnabled is true, we don't manage the buffers, the user does. But there is an exception to that: If mAdvancedSkinningEnabled is true, then we need to manage the skinning/morphing buffers.
| } | ||
| } | ||
| // create buffers | ||
| for (size_t i = 0; i < MAX_VERTEX_BUFFER_COUNT; ++i) { |
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.
Could we not fold the 2nd loop into the first one now?
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.
Yeah, the final bufferSizes should be calculated in the 1st loop prior to buffer creation (2nd loop).
Simplify the buffer object creation logic to streamline and help make the future integration of asynchronous features easier.