Skip to content

shader_carve: exclude the length byte from shader names (SHADER-CARVE-NAME-LENGTH) - #1361

Open
x2Tweek wants to merge 1 commit into
ProjectLeonida:mainfrom
x2Tweek:fix-carve-name
Open

x2Tweek wants to merge 1 commit into
ProjectLeonida:mainfrom
x2Tweek:fix-carve-name

Conversation

@x2Tweek

@x2Tweek x2Tweek commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: SHADER-CARVE-NAME-LENGTH (#14 (comment))

What and why

A printable name-length byte can be captured as the first letter of a shader name. Interpret the length after matching the candidate header so both the Python and optional native scanners use the same name handling. Check for a length field immediately before the match to preserve a real first character that happens to have the same value as the matched name length.

The correction changes some output filenames and translation-index keys. Existing work folders need the shaders stage again. Run python -I make_game.py --stages shaders with your usual game and work-folder options. A missing or stale carve-source digest tells that stage to recarve, unpack, disassemble and translate.

Tested

  • python -I tests/test_shader_carve.py, python -I tests/test_shader_stage_resume.py, python -I tests/test_shader_stage_manifest.py, python -I tests/test_shader_library.py, and python -I tests/test_text_write_line_endings.py.
  • Built the optional scanner with cargo build --release --offline --manifest-path tools/shader_carve_native/Cargo.toml and ran python -I tests/test_shader_carve_native.py with LEONIDA_TEST_REQUIRE_SHADER_CARVE_NATIVE=1. Also ran the new carve regression with LEONIDA_SHADER_CARVE_NATIVE=0.
  • Measured on one 1.0.2.1 translation index (counts only): 6,275 of 26,503 shader names (24%) have a first character whose code equals the name's own length, which is the stray length byte this change removes; chance alone would give about 1-2%. Those names, and the index keys built from them, change; the shaders stage must therefore run again (carve, then translation) on existing work folders.
  • 126 targeted tests passed. One shader-library symlink subtest was skipped because Windows denied symlink creation. Python compilation, make_game.py --help, the game-data check and git diff --check passed.

GPUs tested: n/a. CPU-only synthetic fixtures and mocked pipeline tools on Windows. No retail corpus run.

AI-assisted: yes.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.

@x2Tweek

x2Tweek commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Local verification of PR #1361 changes (shader_carve length-byte fix), run on Windows with Python 3.15.2:

  • tests/test_shader_carve.py: 32 passed, 0 failed
  • tests/test_shader_stage_resume.py: 48 passed, 0 failed
  • python -m compileall -q make_game.py tools/shader_carve.py tests/test_shader_carve.py tests/test_shader_stage_resume.py: clean
  • python -I scripts/check_no_game_data.py tools/shader_carve.py make_game.py tests/test_shader_carve.py tests/test_shader_stage_resume.py: clean
  • python -I make_game.py --help: clean

The Windows CI check (windows in Runtime workflow) shows FAILURE; all other completed checks pass (change-scope, no-game-data, linux-gpu-tools). Several CI checks are still QUEUED. Local tests pass on this machine; the Windows failure may be environmental or pre-existing.

AI-assisted: yes (Claude Code)

No game data, no local paths, no secrets.

@x2Tweek

x2Tweek commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

The three failures at merge commit 3e48a50eb reproduce on upstream baselines:

AI-assisted: yes.

@DadaCap

DadaCap commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this! Excluding the length byte from carved shader names fixes names that picked up a stray first character.

During maintainer testing (local, 2026-11-28) (head 4adb409, merged on main b1619e0 / 6dfca64, Windows 11, Python tests via pytest/unittest) we found:

  • Review finding: this changes carved and translated shader names, so every existing work folder re-carves, and the format claim has no row in docs/design.md and no count over the corpus.

To get this merged:

  • Add the corpus count and the docs/design.md row.
  • Confirm nothing looks shaders up by the old name, and note the forced re-carve in the PR description.

AI-assisted (Claude Code), posted for DadaCap (maintainer).

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants