refactor(metal4): extract build_vertex_index_bytes for shared use #398

Manually merged
github merged 2 commits from gh-pr/398/head into gh-pr/398/base 2026-11-26 20:33:17 +00:00
Owner

@⁠maple-quartz18 on GitHub · 2026-11-26 19:09 UTC · original
maple-quartz18:p0-extract-build-vertex-index-bytes → master · +41 −26 · 1 files · 2 commits · merged 2026-11-26 20:22 UTC

What

Pure refactor, no behavior change. Move the vertex/index/mesh assembly out of upload_shared() into a new pure public function build_vertex_index_bytes().

Why

This is the prerequisite for a GPU-ready model buffer cache. Runtime upload and offline baking need to produce identical vertex/index bytes. With a single shared assembler, cache payloads are byte-identical by construction instead of by convention.

Verification

  • material_count is exactly equivalent to the previous materials.len() (1 when model.materials is empty, otherwise its length).
  • All dependencies (bail!, Context, Vec3, bytemuck) are already file-level imports; the new function compiles as-is.
  • The assembled bytes are produced by the same vertex4(), GpuMesh4 fields and order as before.
**@⁠maple-quartz18** on GitHub · 2026-11-26 19:09 UTC · [original](https://github.com/holdmysocks/SixNG/pull/398) `maple-quartz18:p0-extract-build-vertex-index-bytes` → `master` · +41 −26 · 1 files · 2 commits · merged 2026-11-26 20:22 UTC ## What Pure refactor, **no behavior change**. Move the vertex/index/mesh assembly out of `upload_shared()` into a new pure public function `build_vertex_index_bytes()`. ## Why This is the prerequisite for a GPU-ready model buffer cache. Runtime upload and offline baking need to produce identical vertex/index bytes. With a single shared assembler, cache payloads are byte-identical by construction instead of by convention. ## Verification - `material_count` is exactly equivalent to the previous `materials.len()` (1 when `model.materials` is empty, otherwise its length). - All dependencies (`bail!`, `Context`, `Vec3`, `bytemuck`) are already file-level imports; the new function compiles as-is. - The assembled bytes are produced by the same `vertex4()`, `GpuMesh4` fields and order as before.
Move the vertex/index/mesh assembly out of upload_shared() into a pure
public function. No behavior change. This is the prerequisite for the
GPU-ready model buffer cache: runtime upload and offline baking will call
the same function, guaranteeing byte-identical cache payloads.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:33:14 +00:00
github manually merged commit a8ce3e85ec into gh-pr/398/base 2026-11-26 20:33:17 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-26 19:09 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-26 19:09 UTC · [original](https://github.com/holdmysocks/SixNG/pull/398#pullrequestreview-6079343476) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
This discussion has been locked. Commenting is limited to contributors.
No description provided.