glb_skinning: avoid copying padded BIN data for every accessor #1754

Open
github-bot wants to merge 1 commit from github-bot/gh-1754 into main AGit
Owner

@⁠kirigayakazima on GitHub · 2026-11-25 11:14 UTC · original
kirigayakazima:codex/glb-skinning-padded-buffer-copies → main · +40 −7 · 2 files · 1 commits · open

Claimed in the coordination issue as: GLB-SKINNING-PADDED-BUFFER-COPIES

What and why

The analyzer copied each chunk before determining its purpose and sliced the BIN bytes down to the declared buffer length on each accessor read. With 1–3 bytes of alignment padding, each slice copied the entire buffer. Analysis now reads from a view of the original immutable bytes and enforces the existing declared-length checks. The public parse_glb helper still returns BIN bytes.

Tested

On the integration checkout a synthetic three-vertex model with a 16 MiB padded BIN and a 16 MiB extension chunk produced identical reports before and after. Starting tracemalloc after constructing the input, peak traced allocation during analysis fell from 33,562,127 to 8,532 bytes (Python 3.14.7). The regression uses smaller chunks and also checks that a buffer view cannot read into BIN padding.

  • python -I tests/test_glb_skinning.py passed all 28 tests on this branch (Windows, Python 3.14.7).
  • git diff --check and the repository game-data scan of all changed paths passed.
  • The five independent changes were also merged locally. Both affected test files passed together (50 tests) and the three character-model consumer suites passed (28 tests). The shared base at bcaa13da passed 6,287 semantic tests across 488 files.

GPUs tested: N/A (CPU-only asset tooling).
AI-assisted: Yes.

Checklist

  • Based on current upstream main.
  • One topic.
  • Only synthetic test fixtures. No game data, keys or decryption.
  • Translator contract table: N/A.
**@⁠kirigayakazima** on GitHub · 2026-11-25 11:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1754) `kirigayakazima:codex/glb-skinning-padded-buffer-copies` → `main` · +40 −7 · 2 files · 1 commits · open Claimed in the coordination issue as: [GLB-SKINNING-PADDED-BUFFER-COPIES](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why The analyzer copied each chunk before determining its purpose and sliced the BIN bytes down to the declared buffer length on each accessor read. With 1–3 bytes of alignment padding, each slice copied the entire buffer. Analysis now reads from a view of the original immutable bytes and enforces the existing declared-length checks. The public `parse_glb` helper still returns BIN bytes. ### Tested On the integration checkout a synthetic three-vertex model with a 16 MiB padded BIN and a 16 MiB extension chunk produced identical reports before and after. Starting tracemalloc after constructing the input, peak traced allocation during analysis fell from 33,562,127 to 8,532 bytes (Python 3.14.7). The regression uses smaller chunks and also checks that a buffer view cannot read into BIN padding. - `python -I tests/test_glb_skinning.py` passed all 28 tests on this branch (Windows, Python 3.14.7). - `git diff --check` and the repository game-data scan of all changed paths passed. - The five independent changes were also merged locally. Both affected test files passed together (50 tests) and the three character-model consumer suites passed (28 tests). The shared base at `bcaa13da` passed 6,287 semantic tests across 488 files. GPUs tested: N/A (CPU-only asset tooling). AI-assisted: Yes. ### Checklist - [x] Based on current upstream main. - [x] One topic. - [x] Only synthetic test fixtures. No game data, keys or decryption. - Translator contract table: N/A.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:03:46 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-25 11:20 UTC · original · reviewed

Independent check at "0307e4c0". Windows: all 28 skinning tests passed. On a separate synthetic skinned triangle with a padded 16 MiB BIN and a 16 MiB extension chunk, the base and PR analysis reports matched. Peak Python-traced allocation during analysis dropped from 33,562,039 to 8,416 bytes. The public parse_glb helper still returned bytes.

AI-assisted review and CPU-only testing with synthetic inputs.

**@⁠lixonik** on GitHub · 2026-11-25 11:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1754#pullrequestreview-6056673755) · **reviewed** Independent check at "0307e4c0". Windows: all 28 skinning tests passed. On a separate synthetic skinned triangle with a padded 16 MiB BIN and a 16 MiB extension chunk, the base and PR analysis reports matched. Peak Python-traced allocation during analysis dropped from 33,562,039 to 8,416 bytes. The public parse_glb helper still returned bytes. AI-assisted review and CPU-only testing with synthetic inputs.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1754/head:github-bot/gh-1754'
git switch 'github-bot/gh-1754'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1754'
git switch 'github-bot/gh-1754'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1754'
git switch 'github-bot/gh-1754'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1754'
git switch 'main'
git merge --squash 'github-bot/gh-1754'
git switch 'main'
git merge --ff-only 'github-bot/gh-1754'
git switch 'main'
git merge 'github-bot/gh-1754'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.