[PR #1754] glb_skinning: avoid copying padded BIN data for every accessor #1767

Open
opened 2026-11-26 21:18:53 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1754
Author: @kirigayakazima
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: codex/glb-skinning-padded-buffer-copies


📝 Commits (1)

  • 0307e4c glb_skinning: avoid copying padded BIN data for every accessor

📊 Changes

2 files changed (+40 additions, -7 deletions)

View changed files

📝 tests/test_glb_skinning.py (+29 -0)
📝 tools/glb_skinning.py (+11 -7)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1754 **Author:** [@kirigayakazima](https://github.com/kirigayakazima) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/glb-skinning-padded-buffer-copies` --- ### 📝 Commits (1) - [`0307e4c`](https://github.com/ubiquitarianism/leonida/commit/0307e4c0fbd7e59e15b35063874011c80f78c5d7) glb_skinning: avoid copying padded BIN data for every accessor ### 📊 Changes **2 files changed** (+40 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_glb_skinning.py` (+29 -0) 📝 `tools/glb_skinning.py` (+11 -7) </details> ### 📄 Description Claimed in the coordination issue as: [GLB-SKINNING-PADDED-BUFFER-COPIES](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7160621714) ### 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1767
No description provided.