Skip to content

Conversation

@z3moon
Copy link
Contributor

@z3moon z3moon commented Nov 14, 2025

Simplify the buffer object creation logic to streamline and help make the future integration of asynchronous features easier.

@z3moon z3moon added the internal Issue/PR does not affect clients label Nov 14, 2025
@z3moon z3moon enabled auto-merge (squash) November 14, 2025 01:39
@z3moon z3moon marked this pull request as draft November 14, 2025 01:49
auto-merge was automatically disabled November 14, 2025 01:49

Pull request was converted to draft

Simplify the buffer object creation logic to streamline and help make
the future integration of asynchronous features easier.
@z3moon z3moon marked this pull request as ready for review November 14, 2025 03:18
auto shouldCreateBuffer = [this](size_t attributeIndex) {
if (mBufferObjectsEnabled) {
if (!mAdvancedSkinningEnabled) {
return false;
Copy link
Contributor Author

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?

Copy link
Collaborator

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.

Comment on lines 287 to 288
if (mBufferObjectsEnabled) {
if (!mAdvancedSkinningEnabled) {
Copy link
Collaborator

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.

Copy link
Contributor Author

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;
Copy link
Collaborator

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) {
Copy link
Collaborator

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?

Copy link
Contributor Author

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Issue/PR does not affect clients

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants