startup: re-key slot 57 mesh requests in shader_cache_rekey.py (Part of #2413) #2626

Merged
Leyukaka merged 1 commit from upstream-pr/2634 into main 2026-11-25 23:56:42 +00:00
Leyukaka commented 2026-11-25 23:50:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-25T23:50:29Z.


Part of #2413 (claim).

tools/startup/shader_cache_rekey.py (from #2401) re-keyed graphics, RTV variant and slot 67 compute requests, and only counted slot 57 mesh requests. mesh57_key hashes the request files under a versioned prefix (x2w-startup-mesh-57-2), so after a revision that changes that prefix a kept cache lost every slot 57 request: --pending refuses a file under its old name with slot 57 mesh request key mismatch.

This re-keys them:

  • A slot 57 request is .ps57, .root and the .m57 ready marker; .ps57 is empty without a pixel stage. The new key is mesh57_key(m57, ps57, root).
  • The rules the tool applies to the other kinds hold. Every request is read first, nothing is written when a part is missing or unreadable (exit 1), each file goes to a temporary name and is renamed with the ready marker last, and an existing target is left alone. The summary gains an m57: line.
  • Slot 86 requests (mesh86_cache.py, their own key and a .stream86 part) are still only counted.
  • docs/startup-runtime.md describes the slot 57 parts.

#2592 also edits this tool, for the pixel input masks in the graphics key. Whichever lands second will need a small textual rebase in the docstring, PARTS and current_key.

Tests (Windows 11, Python 3.14), on main 66026a3 plus this commit:

  • python -B tests/startup_shader_cache_rekey_check.py: all checks passed.
    • A slot 57 request under a stale name and one under its current name are each written under their current name with the same bytes, and gfx2hlsl.pending_keys lists them.
    • A second run keeps every name. A missing slot 57 .root or .ps57 exits with 1 and writes nothing.
    • A slot 86 marker is only counted.
  • python -B tests/startup_shader_cache_rekey_cli_check.py: ok (its summary assertion now reads not re-keyed (own key strings): m86 1).
  • Also ok: docs_links_check, bidi_controls_check, startup_translator_check.
  • Mutation, run by hand: keeping the old mesh key instead of mesh57_key fails the check (the old name is written instead of the current one).

Measured on a local cache (counts only, inputs private) kept from an earlier revision: the tool wrote 497 slot 57 requests under current names, next to 2,689 compute requests and 95 RTV variants.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6616181636 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2634). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-25T23:50:29Z. --- Part of #2413 ([claim](https://github.com/R0Y00/Xbox2Windows/issues/2413#issuecomment-7177845265)). `tools/startup/shader_cache_rekey.py` (from #2401) re-keyed graphics, RTV variant and slot 67 compute requests, and only counted slot 57 mesh requests. `mesh57_key` hashes the request files under a versioned prefix (`x2w-startup-mesh-57-2`), so after a revision that changes that prefix a kept cache lost every slot 57 request: `--pending` refuses a file under its old name with `slot 57 mesh request key mismatch`. This re-keys them: - A slot 57 request is `.ps57`, `.root` and the `.m57` ready marker; `.ps57` is empty without a pixel stage. The new key is `mesh57_key(m57, ps57, root)`. - The rules the tool applies to the other kinds hold. Every request is read first, nothing is written when a part is missing or unreadable (exit 1), each file goes to a temporary name and is renamed with the ready marker last, and an existing target is left alone. The summary gains an `m57:` line. - Slot 86 requests (`mesh86_cache.py`, their own key and a `.stream86` part) are still only counted. - `docs/startup-runtime.md` describes the slot 57 parts. #2592 also edits this tool, for the pixel input masks in the graphics key. Whichever lands second will need a small textual rebase in the docstring, `PARTS` and `current_key`. **Tests** (Windows 11, Python 3.14), on main `66026a3` plus this commit: - `python -B tests/startup_shader_cache_rekey_check.py`: all checks passed. - A slot 57 request under a stale name and one under its current name are each written under their current name with the same bytes, and `gfx2hlsl.pending_keys` lists them. - A second run keeps every name. A missing slot 57 `.root` or `.ps57` exits with 1 and writes nothing. - A slot 86 marker is only counted. - `python -B tests/startup_shader_cache_rekey_cli_check.py`: ok (its summary assertion now reads `not re-keyed (own key strings): m86 1`). - Also ok: `docs_links_check`, `bidi_controls_check`, `startup_translator_check`. - Mutation, run by hand: keeping the old mesh key instead of `mesh57_key` fails the check (the old name is written instead of the current one). **Measured on a local cache** (counts only, inputs private) kept from an earlier revision: the tool wrote 497 slot 57 requests under current names, next to 2,689 compute requests and 95 RTV variants. AI-assisted.
upstream-sync closed this pull request 2026-11-26 00:01:07 +00:00
tedin7 commented 2026-11-26 00:01:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T23:56:45Z.

Review: COMMENTED


Review of head bba44089 against main (comment only, no code changes).

What I checked:

  • mesh57_key(ms, ps, root) in gfx2hlsl.py:7733 takes (m57, ps57, root). current_key passes the same order. Good.
  • PARTS['m57'] has the ready marker last, so the existing write order rule holds. .ps57 stays a required part, an empty file is fine.
  • Slot 86 is still only counted, and the summary line matches the new behavior.
  • Sibling kinds (graphics, compute, RTV) are unchanged. Docs match the code.

Commands run locally on the exact head:

  • python3 -B tests/startup_shader_cache_rekey_check.py: all checks passed
  • python3 -B tests/startup_shader_cache_rekey_cli_check.py: OK
  • python3 tests/docs_links_check.py: 506 links ok
  • python3 tests/bidi_controls_check.py: no controls
  • git diff --check origin/main...HEAD: clean
  • Mutation 1: swap the argument order in mesh57_key(...) call -> the rekey test fails (6 failed).
  • Mutation 2: drop .ps57 from PARTS['m57'] -> the rekey test crashes.

No blocking findings. Note: #2592 touches the same file, a small rebase is expected for whichever lands second.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6066672921 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2634#pullrequestreview-6066672921). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T23:56:45Z. **Review:** COMMENTED --- Review of head bba44089 against main (comment only, no code changes). What I checked: - `mesh57_key(ms, ps, root)` in `gfx2hlsl.py:7733` takes (m57, ps57, root). `current_key` passes the same order. Good. - `PARTS['m57']` has the ready marker last, so the existing write order rule holds. `.ps57` stays a required part, an empty file is fine. - Slot 86 is still only counted, and the summary line matches the new behavior. - Sibling kinds (graphics, compute, RTV) are unchanged. Docs match the code. Commands run locally on the exact head: - `python3 -B tests/startup_shader_cache_rekey_check.py`: all checks passed - `python3 -B tests/startup_shader_cache_rekey_cli_check.py`: OK - `python3 tests/docs_links_check.py`: 506 links ok - `python3 tests/bidi_controls_check.py`: no controls - `git diff --check origin/main...HEAD`: clean - Mutation 1: swap the argument order in `mesh57_key(...)` call -> the rekey test fails (6 failed). - Mutation 2: drop `.ps57` from `PARTS['m57']` -> the rekey test crashes. No blocking findings. Note: #2592 touches the same file, a small rebase is expected for whichever lands second. AI-assisted; commands listed were executed locally.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
R0Y00/Xbox2Windows!2626
No description provided.