Skip to content

[Refactor] Shared per-mesh vertex-stream binding + unknown-chunk regression test - #16

Open
miogds wants to merge 1 commit into
developfrom
feature/deformation_groundwork
Open

[Refactor] Shared per-mesh vertex-stream binding + unknown-chunk regression test#16
miogds wants to merge 1 commit into
developfrom
feature/deformation_groundwork

Conversation

@miogds

@miogds miogds commented Aug 4, 2026

Copy link
Copy Markdown
Member

What

  • Adds bindModelVertexStreams / bindShadowVertexStreams encoder helpers (Renderer/RenderVertexStreamBinding.swift) and replaces the nine open-coded per-mesh vertex-buffer bind sites across the model, shadow (CSM/spot/point), transparency, and wireframe passes plus RenderExtensionModelSurface. Batched-geometry sites keep their raw batch-buffer binds (they never deform).
  • Adds testUnknownCoreChunkTypeIsIgnored to NativeFormatTests: a core-range chunk type unknown to the runtime must not prevent the rest of a .untold asset from loading (guards forward compatibility for upcoming format chunks).

Why

Groundwork for a deformation compute pre-pass: the helpers become the single point where deformed position/normal buffers can replace the base vertex streams for every pass at once. Zero behavior change intended.

Verification

  • swift build clean; unit test target green except ExternalRenderExtensionPackageTests (pre-existing local toolchain/SDK mismatch, fails identically on develop).
  • AnimationTests/test_referenceKeyframes renders compared pixel-by-pixel against a clean develop baseline run: all five pose images are bit-identical. (The test itself fails on develop too: compare_psnr.py needs cv2, and the current renders differ from the checked-in references.)
  • SwiftFormat 0.60.1 lint clean on changed files.

Note for reviewers: the shadow-pass sites previously indexed the source metalKitMesh.vertexBuffers array with modelPass* enums while binding to shadowPass* slots — that was correct (the array is in model-descriptor order); the helper now encodes that distinction explicitly.

Replace the nine open-coded per-mesh vertex buffer bind sites in the
model-family and shadow-family passes with bindModelVertexStreams /
bindShadowVertexStreams encoder helpers. Batched-geometry sites keep
their raw batch-buffer binds.

Also add a reader regression test covering unknown core-range chunk
types so future format chunks cannot brick older runtimes.

Groundwork for the deformation compute pass: the helpers are the single
point where deformed position/normal buffers will replace the base
streams.
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