runtime: key slot 57 profiles by stable descriptor fields #3750

Closed
github-bot wants to merge 4 commits from github-bot/gh-3748 into main AGit
Owner

@⁠lambirou on GitHub · 2026-12-01 14:53 UTC · original
lambirou:codex/mesh57-profile-key → main · +337 −19 · 9 files · 4 commits · closed without merging

The slot 57 profile name was derived from the descriptor produced by
normalize_mesh57_descriptor, which keeps the relative section and shader
record offsets because the stream key uses them. Those offsets change with the
process allocation, so a profile authored from one run never matched the next
one: the 180 s run reported profile_absent 10 726 and ready 0, and two
captured variants with identical state blocks still produced different names.

This adds stable_mesh57_profile_descriptor, which clears the pointer and
relocation words of the 0x300-byte descriptor while keeping sizes, formats and
scalar state. The stable form names and finds <variant>.mesh57-state, and
the stored descriptor is compared after the same normalization; the stream-key
normalization and its test are unchanged. The Python authoring tools write and
validate the stable name, and mesh57_pixel_entry.py compares the descriptor
in the stable form.

Validation (Windows, Release; AMD Radeon RX 9060 XT for the hardware run):

  • ctest --preset release --no-tests=error -R '^(native_fixed_mesh57(_mrt)?_warp|startup_indirect_mesh_create_result_warp)$'
    — 3/3 pass; the fixture prints mesh57 profile key: relocations collapse, metadata/scalar differ, idempotent.
  • The two captures 4d90315b3d7500e2 and b92ce68218bb5610 now both derive
    9482ea4411e1e03f; the profile is 15 344 bytes and passes
    mesh57_profile.py --check.
  • A 180 s title run with X2W_NATIVE_SHADERS now opens the profile and reaches
    lowering_reached 1; the remaining refusal is the separate
    mesh heap descriptor address form at +0x614.
  • mesh57_profile_draft_check.py, startup_mesh57_depth_only_check.py,
    docs_links_check.py and startup_tools_lint_check.py tools/startup pass.

Refs #3499
Refs #3726

**@⁠lambirou** on GitHub · 2026-12-01 14:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3748) `lambirou:codex/mesh57-profile-key` → `main` · +337 −19 · 9 files · 4 commits · closed without merging The slot 57 profile name was derived from the descriptor produced by `normalize_mesh57_descriptor`, which keeps the relative section and shader record offsets because the stream key uses them. Those offsets change with the process allocation, so a profile authored from one run never matched the next one: the 180 s run reported `profile_absent 10 726` and `ready 0`, and two captured variants with identical state blocks still produced different names. This adds `stable_mesh57_profile_descriptor`, which clears the pointer and relocation words of the 0x300-byte descriptor while keeping sizes, formats and scalar state. The stable form names and finds `<variant>.mesh57-state`, and the stored descriptor is compared after the same normalization; the stream-key normalization and its test are unchanged. The Python authoring tools write and validate the stable name, and `mesh57_pixel_entry.py` compares the descriptor in the stable form. Validation (Windows, Release; AMD Radeon RX 9060 XT for the hardware run): - `ctest --preset release --no-tests=error -R '^(native_fixed_mesh57(_mrt)?_warp|startup_indirect_mesh_create_result_warp)$'` — 3/3 pass; the fixture prints `mesh57 profile key: relocations collapse, metadata/scalar differ, idempotent`. - The two captures `4d90315b3d7500e2` and `b92ce68218bb5610` now both derive `9482ea4411e1e03f`; the profile is 15 344 bytes and passes `mesh57_profile.py --check`. - A 180 s title run with `X2W_NATIVE_SHADERS` now opens the profile and reaches `lowering_reached 1`; the remaining refusal is the separate `mesh heap descriptor address` form at `+0x614`. - `mesh57_profile_draft_check.py`, `startup_mesh57_depth_only_check.py`, `docs_links_check.py` and `startup_tools_lint_check.py tools/startup` pass. Refs #3499 Refs #3726
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 14:54:22 +00:00
Author
Owner

@⁠Leyukaka on GitHub · 2026-12-01 15:31 UTC · original · requested changes

The profile key and stored-descriptor comparison both discard bytes even when the descriptor layout is unrecognized. Consider two 0x300-byte descriptors with an unrecognized marker at +0x11c. They differ only at +0x1b8 (0x40 versus 0x80), with the same shaders and state blocks. Both select the same profile and pass its descriptor check. Please preserve the unclassified bytes or reject that layout, and add a negative test showing that a profile generated for one cannot authorize the other.

The shared-base fixture in #3732 shifts the values at +0x188, +0x1c8 and +0x2e8 together. Those bytes still participate verbatim in this profile key, so that relocation can prevent lookup of a matching profile. Please reconcile the two changes and test both a common shift (same profile key) and a change to the spacing (different key).

**@⁠Leyukaka** on GitHub · 2026-12-01 15:31 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3748#pullrequestreview-6134437490) · **requested changes** The profile key and stored-descriptor comparison both discard bytes even when the descriptor layout is unrecognized. Consider two 0x300-byte descriptors with an unrecognized marker at +0x11c. They differ only at +0x1b8 (0x40 versus 0x80), with the same shaders and state blocks. Both select the same profile and pass its descriptor check. Please preserve the unclassified bytes or reject that layout, and add a negative test showing that a profile generated for one cannot authorize the other. The shared-base fixture in #3732 shifts the values at +0x188, +0x1c8 and +0x2e8 together. Those bytes still participate verbatim in this profile key, so that relocation can prevent lookup of a matching profile. Please reconcile the two changes and test both a common shift (same profile key) and a change to the spacing (different key).
Author
Owner

@⁠lambirou on GitHub · 2026-12-01 16:11 UTC · original

Thanks. Both points are addressed in 15df9040.

Layout gate and unclassified bytes. stable_mesh57_profile_descriptor now first recognizes the same 0x300 layout as normalize_mesh57_descriptor/ #3732: +0x11c and +0x27c must be 0x04010000, +0x48/+0x50 zero, +0x30/+0x70 non-zero, and the ten required record pointers must be within INT32_MAX of the +0x38 section base. Any other 0x300 descriptor is returned unchanged. The negative test uses an unknown +0x11c and +0x1b8 0x40 versus 0x80: the stable bytes and profile keys differ, so a profile generated for one cannot pass the stored-descriptor check for the other. Optional pointers +0x198, +0x1b8, +0x1d8, +0x2f8 are made relative only when they are near the section.

#3730 second base. The 32-bit values at +0x188, +0x1a8, +0x1c8, +0x2e8 are now reduced to their distance from the first valid value. A common shift gives the same key; changing the spacing from 0x2f100 to 0x2f200 gives a different key. Small values such as 0x40/0x80 stay metadata and still distinguish profiles. +0x188/+0x1a8/+0x1c8/+0x2e8 are not cleared.

The two survey captures 4d90315b3d7500e2 and b92ce68218bb5610 now both map to profile key 1387cf9e765e57ad.

Tests:

ctest --preset release --no-tests=error -R '^(startup_indirect_mesh_create_result_warp|native_fixed_mesh57(_mrt)?_(warp|hardware))$' -j 1
5/5 passed

python -B tests/mesh57_profile_draft_check.py
slot 57 profile draft, review, depth-only and refusal checks passed

python -B tests/docs_links_check.py
208 Markdown files, 802 links: passed

python -B tests/native_direct_mesh_check.py .../compile_dxil.exe <DXC dir>
mesh allocation, indexed outputs, group exchange and negative controls passed

normalize_mesh57_descriptor and its stream-key test are unchanged.

Refs #3499 #3726

**@⁠lambirou** on GitHub · 2026-12-01 16:11 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3748#issuecomment-7317177013) Thanks. Both points are addressed in `15df9040`. **Layout gate and unclassified bytes.** `stable_mesh57_profile_descriptor` now first recognizes the same 0x300 layout as `normalize_mesh57_descriptor`/ #3732: `+0x11c` and `+0x27c` must be `0x04010000`, `+0x48`/`+0x50` zero, `+0x30`/`+0x70` non-zero, and the ten required record pointers must be within `INT32_MAX` of the `+0x38` section base. Any other 0x300 descriptor is returned **unchanged**. The negative test uses an unknown `+0x11c` and `+0x1b8` `0x40` versus `0x80`: the stable bytes and profile keys differ, so a profile generated for one cannot pass the stored-descriptor check for the other. Optional pointers `+0x198`, `+0x1b8`, `+0x1d8`, `+0x2f8` are made relative only when they are near the section. **#3730 second base.** The 32-bit values at `+0x188`, `+0x1a8`, `+0x1c8`, `+0x2e8` are now reduced to their distance from the first valid value. A common shift gives the same key; changing the spacing from `0x2f100` to `0x2f200` gives a different key. Small values such as `0x40`/`0x80` stay metadata and still distinguish profiles. `+0x188`/`+0x1a8`/`+0x1c8`/`+0x2e8` are not cleared. The two survey captures `4d90315b3d7500e2` and `b92ce68218bb5610` now both map to profile key **`1387cf9e765e57ad`**. Tests: ```text ctest --preset release --no-tests=error -R '^(startup_indirect_mesh_create_result_warp|native_fixed_mesh57(_mrt)?_(warp|hardware))$' -j 1 5/5 passed python -B tests/mesh57_profile_draft_check.py slot 57 profile draft, review, depth-only and refusal checks passed python -B tests/docs_links_check.py 208 Markdown files, 802 links: passed python -B tests/native_direct_mesh_check.py .../compile_dxil.exe <DXC dir> mesh allocation, indexed outputs, group exchange and negative controls passed ``` `normalize_mesh57_descriptor` and its stream-key test are unchanged. Refs #3499 #3726
Author
Owner

@⁠lambirou on GitHub · 2026-12-02 14:46 UTC · original · reviewed

Re-reviewed c71ba7f8 after the layout-gating fix. Read the delta, not built here.

Verdict: approve. The profile key now returns the descriptor byte-for-byte when the extended layout is not recognized, so an unknown 0x300 descriptor cannot collide by discarding bytes. For a recognized layout, the optional record pointers become section-relative and the four second-base words keep only their spacing.

  • Checked, no finding: the guard requires the section pointer, the two 0x04010000 markers and every required pointer near the section; the optional pointers are normalized only when they are real pointers; the second-base loop preserves small metadata values; the C++ and Python implementations agree. The new unit and C++ controls cover the 0x40/0x80 unknown-layout case, a common second-base shift and a spacing change.
  • NIT The second-base subtraction can underflow if a later value is smaller than the first; the fixture's values are monotonic. The layout guard makes that unlikely, but a range check or a comment would keep a malformed descriptor from producing a surprising key.

The PR is still DIRTY against main; rebase and rerun the profile-draft check before merge.

**@⁠lambirou** on GitHub · 2026-12-02 14:46 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3748#pullrequestreview-6153093669) · **reviewed** Re-reviewed `c71ba7f8` after the layout-gating fix. Read the delta, not built here. **Verdict: approve.** The profile key now returns the descriptor byte-for-byte when the extended layout is not recognized, so an unknown 0x300 descriptor cannot collide by discarding bytes. For a recognized layout, the optional record pointers become section-relative and the four second-base words keep only their spacing. - Checked, no finding: the guard requires the section pointer, the two 0x04010000 markers and every required pointer near the section; the optional pointers are normalized only when they are real pointers; the second-base loop preserves small metadata values; the C++ and Python implementations agree. The new unit and C++ controls cover the 0x40/0x80 unknown-layout case, a common second-base shift and a spacing change. - **NIT** The second-base subtraction can underflow if a later value is smaller than the first; the fixture's values are monotonic. The layout guard makes that unlikely, but a range check or a comment would keep a malformed descriptor from producing a surprising key. The PR is still `DIRTY` against main; rebase and rerun the profile-draft check before merge.
github-bot force-pushed github-bot/gh-3748 from c71ba7f8fd to 47a6053766 2026-12-02 14:58:23 +00:00 Compare
Author
Owner

@⁠lambirou on GitHub · 2026-12-02 18:52 UTC · original

Superseded by #3732 (33c8ef57), which implements the same stable slot 57 descriptor key in
ormalize_mesh57_descriptor with layout version 2, and already gates unknown layouts. Closing to avoid a second, conflicting key implementation. Reopen if a byte-level difference remains after #3732.

**@⁠lambirou** on GitHub · 2026-12-02 18:52 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3748#issuecomment-7355280114) Superseded by #3732 (33c8ef57), which implements the same stable slot 57 descriptor key in ormalize_mesh57_descriptor with layout version 2, and already gates unknown layouts. Closing to avoid a second, conflicting key implementation. Reopen if a byte-level difference remains after #3732.
github-bot closed this pull request 2026-12-02 19:05:05 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.