Skip to content

Round capacity estimates to multiples of 4 to make sure allocations are always aligned#3522

Open
xirreal wants to merge 1 commit intoCaffeineMC:devfrom
xirreal:dev
Open

Round capacity estimates to multiples of 4 to make sure allocations are always aligned#3522
xirreal wants to merge 1 commit intoCaffeineMC:devfrom
xirreal:dev

Conversation

@xirreal
Copy link

@xirreal xirreal commented Feb 24, 2026

Closes #3509

newCapacity = (long) (requiredTotalSize * FEW_SEGMENTS_GROWTH_FACTOR);
}
return newCapacity;
return (newCapacity + 3) & ~3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the elaboration you gave on discord and the fact that due to

GlBufferSegment b = new GlBufferSegment(this, a.getEnd() - size, size);
, an unaligned capacity causes an unaligned tail and that causes an unaligned segment.

@douira douira self-assigned this Feb 24, 2026
@douira douira added the A-drivers Area: Driver compatibility label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-drivers Area: Driver compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect assumption that buffer size matches the stride of primitive vertex count

2 participants