Skip to content

fix(meshlet): recognize joint-index streams in packed vertex blocks - #3584

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
jeremygold02:fix/meshlet-joint-tag
Nov 23, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
jeremygold02:fix/meshlet-joint-tag

Conversation

@jeremygold02

Copy link
Copy Markdown
Contributor

Claim on #3381. Related format measurements: #2787 and #2859. The code change applies directly to main.

What changed

A packed vertex block can contain a four-byte joint-index stream tagged 0x25. The slot-type table omitted type 5, so a directory scan silently skipped the entire block, including its supported position stream. This change lets the existing stride rule size that slot. The synthetic regression puts the joint indices between two other streams and checks the offset of the next meshlet group. An unknown type still exercises the rejection path.

Verification

I ran the base (f847748c) and PR (dbe76fd8) page readers against every distinct primary-LOD vertex buffer reached by the pinned decoder in my Xbox 1.0.2.1 data.rpf. The comparison covers 3,314 buffers from 3,175 decoded drawables.

Reader outcome Buffers
Newly accepted 3,021
Previously accepted, identical record 289
Rejected by both 4
Previously accepted, now rejected 0

All 3,021 newly accepted blocks carried 0x25 in slot 8. Each declared a four-byte stride in the separate system layout, and its distance to the following stream equaled four bytes times the vertex count. The four outstanding blocks contain only a position slot, so this reader lacks a following stream from which to infer the vertex count. Its error was the same on both revisions.

On one buffer checked separately through the directory CLI, the base found zero pages and the PR found one. Every one of its 1,656 XYZ triples matched the pinned decoder at binary32 precision. The related authored-shader check on #2519 independently exercised the position layout.

All 84 tests passed: 48 in test_meshlet_page.py, 28 in test_vertex_types.py, and eight in test_restofworld_model_join.py. Applying only the updated tests on the base produced two failures in the slot-tag suite. git diff --check passed.

CPU-only on Intel Core Ultra 7 265K, Windows 11 Home 25H2 build 26200.9974, Python 3.12.10. NVIDIA GeForce RTX 5070 (621.01) and Intel Graphics (32.0.101.9150) were installed and idle. The fixtures are synthetic. The game data and buffers stayed local. AI-assisted.

@Kosmabb8

Copy link
Copy Markdown
Contributor

Independent Windows CPython 3.12.10 check at dbe76fd: all 84 synthetic tests passed (meshlet_page 48, vertex_types 28, restofworld_model_join 8). Replacing only tools/meshlet_page.py with current main f847748 gives exactly two failures: the 0x25 stride assertion and the new joint-index stream-before-another-slot case. Restoring the PR source passes; diff checks and the isolated worktree are clean. This pins actual slot recognition and block traversal rather than a test-only model. I did not rerun the retail corpus comparison and used no game files or GPU. AI-assisted review.

@sds-228

sds-228 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Independent CPU check of dbe76fd8 on Windows 11, Python 3.13:

  • tests/test_meshlet_page.py 48/48 OK, tests/test_vertex_types.py 28/28 OK, tests/test_restofworld_model_join.py 8/8 OK; compileall and git diff --check clean.
  • Negative control: with only tools/meshlet_page.py reverted to base f847748c, the two new slot-tag tests fail (0x25 stride and the joint-index-before-another-stream page), so they guard the change.
  • 0x25 decodes to the expected 4-byte stride under the existing rule, and the unknown-type rejection path is still exercised with 0x2f. The change is a one-entry table addition plus doc text; no other slot behavior is touched.

No issues found. No game data. AI-assisted (OpenCode).

@DenRakEiw

Copy link
Copy Markdown
Contributor

Tested 5f8531b on Windows 11, Python 3.12.10 (CPU only, synthetic fixtures, no game files): pass.

  • Trial-merged onto origin/main (98fa503): merges cleanly; git diff --check clean.
  • python -I tests/test_meshlet_page.py: 61/61 OK (including est_tag_stride, est_block_sized_by_tag_rule, and est_joint_index_stream_before_another_slot).
  • Code read: registering type 5 (

@kapitche

Copy link
Copy Markdown
Contributor

Tested 5f8531b merged with main 98fa503 on Linux (Python 3.12.16): pass. test_meshlet_page.py 1/1 ok. Negative control with main's tools/meshlet_page.py: test_meshlet_page.py fails.

@ItsNotRexed
ItsNotRexed merged commit c77fa34 into ItsNotRexed:main Nov 23, 2026
2 of 7 checks passed
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.

6 participants