Skip to content

Interleave vertex attributes, keeping POSITION in its own buffer - #11

Open
pezcode wants to merge 1 commit into
masterfrom
interleaved-vertex-attributes
Open

Interleave vertex attributes, keeping POSITION in its own buffer#11
pezcode wants to merge 1 commit into
masterfrom
interleaved-vertex-attributes

Conversation

@pezcode

@pezcode pezcode commented Jul 8, 2026

Copy link
Copy Markdown

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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant