Interleave vertex attributes, keeping POSITION in its own buffer - #11
Open
pezcode wants to merge 1 commit into
Open
Interleave vertex attributes, keeping POSITION in its own buffer#11pezcode wants to merge 1 commit into
pezcode wants to merge 1 commit into
Conversation
Meshes previously bound each vertex attribute in a separate Filament buffer (bufferCount 5: POSITION/TANGENTS/COLOR/UV0/UV1). Replace that with a shared buildInterleavedVertexBuffer helper that keeps POSITION alone in buffer 0 — so position-only passes (shadow maps, depth prepass) fetch a tight 12-byte stride — and interleaves TANGENTS/COLOR/UV0/UV1 into buffer 1 (40-byte stride) for vertex-fetch locality in the color pass. All six Geometry commit paths and Surface's primitive-sampler path now materialize their attributes and call the helper; fillDefaultAttributes is removed (the helper fills white/zero for null color/uv inputs). Buffer offsets use constexpr constants guarded by a no-padding static_assert rather than offsetof (which would trip -Winvalid-offsetof under -Werror). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Meshes previously bound each vertex attribute in a separate Filament buffer. Change it so that attributes are interleaved for improved vertex fetch performance. Position stays in a tightly-packaged separate buffer for position-only passes (shadow maps, depth prepass).