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

Closed
lambirou wants to merge 4 commits from upstream-pr/3748 into main
lambirou commented 2026-12-01 14:53:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-01T14:53:08Z.


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 #3497
Refs #3724

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5588201669 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3748). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-01T14:53:08Z. --- 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 #3497 Refs #3724
Leyukaka commented 2026-12-01 15:31:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-01T15:31:08Z.

Review: CHANGES_REQUESTED


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 #3730 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).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6134437490 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3748#pullrequestreview-6134437490). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-01T15:31:08Z. **Review:** CHANGES_REQUESTED --- 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 #3730 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).
lambirou commented 2026-12-01 16:11:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-01T16:11:08Z.


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/ #3730: +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 #3497 #3724

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7317177013 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3748#issuecomment-7317177013). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-01T16:11:08Z. --- 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`/ #3730: `+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 #3497 #3724
lambirou commented 2026-12-02 14:46:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-02T14:46:59Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6153093669 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3748#pullrequestreview-6153093669). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-02T14:46:59Z. **Review:** COMMENTED --- 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 commented 2026-12-02 18:52:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-02T18:52:21Z.


Superseded by #3730 (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 #3730.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7355280114 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3748#issuecomment-7355280114). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-02T18:52:21Z. --- Superseded by #3730 (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 #3730.

Pull request closed

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!3748
No description provided.