gpu: normalize extended slot 57 descriptors without a pixel stage #3859

Manually merged
github merged 2 commits from github-bot/gh-3857 into gh-pr/3857/base 2026-12-03 00:02:11 +00:00 AGit
Owner

@⁠Not-Saii on GitHub · 2026-12-02 13:56 UTC · original
Not-Saii:mesh57/zero-section-descriptor → main · +134 −23 · 5 files · 2 commits · merged 2026-12-02 23:53 UTC

Follow-up to R0Y00/Xbox2Windows#3730 (merged), answering the review question there about extended descriptors whose section pointer at +0x38 is zero.

Extended slot 57 fixed descriptors (0x300 bytes, both 0x04010000 metadata words) without a pixel stage have +0x30 and the section pointer at +0x38 zero. normalize_mesh57_descriptor returned them raw, so their variant changed between runs and tools/startup/mesh57_profile.py refused their archives. This is the "Not covered" limit #3732 left in docs/experiments/native-fixed-mesh57.md.

Change

  • src/startup_stubs/mesh57_profile.h: when +0x30 and +0x38 are both zero, use +0x78 as the base. The same record, optional and second-base slots and the +0x110/+0x270 low words are made relative; +0x38, +0x160 and +0x2c0 are cleared; the presence word at +0x160 carries layout 3. A zero +0x38 with a pixel stage, or a nonzero one without, stays raw. A layout 2 result is not normalized again as layout 3.
  • tools/startup/mesh57_profile.py: normalized_extended keeps #3732's exact-shape rule and ties the layout to the pixel stage: layout 2 with one, layout 3 without one and then +0x78 zero as well. A raw allocation address that reads as 2 or 3 is still refused.
  • Fixtures: mesh57_descriptor_relocations (relocated pair, changed distance, both mismatched pixel/section forms, layout 2 result whose offsets read as pointers from +0x78) and tests/mesh57_profile_draft_check.py (accepted layout 3 archive; raw, layout 3 with a pixel stage, layout 2 without one, and a kept +0x78 base within 2 GiB are refused).

Evidence

  • Offline: 1524 raw archives of this layout from earlier local runs (159 pipelines, 85 captured in more than one run). The helper gives one normalized descriptor per pipeline; no two pipelines share a variant input. +0x110/+0x270 have a constant high word (0x150) in all of them.
  • Two captures on a release build of this change on top of #3732's branch (the helper is unchanged by the rebase), X2W_MESH57_CAPTURE_STATE=1, same scripted input: 84 and 81 layout 3 archives. All 81 names from the second run were also written by the first; the first run's other 3 belong to pipelines the second run did not create. read_creation and the draft accept all 81.
  • Negative controls: removing the pixel-stage guard in the helper, or using the earlier helper, fails mesh57_descriptor_relocations; removing the +0x78 condition or the layout/pixel-stage pairing in the writer fails tests/mesh57_profile_draft_check.py.

Tests

ctest --preset dev --no-tests=error -R '^(native_mesh57_outcomes_warp|startup_indirect_mesh_create_result_warp|startup_indirect_mesh57_stream_key_warp|native_fixed_mesh57(_[a-z0-9_]+)?_warp)$'

20/20 passed on c42b7ce3 + this change (WARP, Windows 11 build 26300). startup_indirect_mesh_cache_heap_wide_warp and native_direct_mesh, which failed in this PR's first CI run on the older base, also pass locally on the new base.

python -B tests/mesh57_profile_draft_check.py
python -B tests/docs_links_check.py

Both pass.

🤖 Generated with Claude Code

**@⁠Not-Saii** on GitHub · 2026-12-02 13:56 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3857) `Not-Saii:mesh57/zero-section-descriptor` → `main` · +134 −23 · 5 files · 2 commits · merged 2026-12-02 23:53 UTC Follow-up to R0Y00/Xbox2Windows#3730 (merged), answering the review question there about extended descriptors whose section pointer at +0x38 is zero. Extended slot 57 fixed descriptors (0x300 bytes, both `0x04010000` metadata words) without a pixel stage have +0x30 and the section pointer at +0x38 zero. `normalize_mesh57_descriptor` returned them raw, so their variant changed between runs and `tools/startup/mesh57_profile.py` refused their archives. This is the "Not covered" limit #3732 left in `docs/experiments/native-fixed-mesh57.md`. ## Change - `src/startup_stubs/mesh57_profile.h`: when +0x30 and +0x38 are both zero, use +0x78 as the base. The same record, optional and second-base slots and the +0x110/+0x270 low words are made relative; +0x38, +0x160 and +0x2c0 are cleared; the presence word at +0x160 carries layout 3. A zero +0x38 with a pixel stage, or a nonzero one without, stays raw. A layout 2 result is not normalized again as layout 3. - `tools/startup/mesh57_profile.py`: `normalized_extended` keeps #3732's exact-shape rule and ties the layout to the pixel stage: layout 2 with one, layout 3 without one and then +0x78 zero as well. A raw allocation address that reads as 2 or 3 is still refused. - Fixtures: `mesh57_descriptor_relocations` (relocated pair, changed distance, both mismatched pixel/section forms, layout 2 result whose offsets read as pointers from +0x78) and `tests/mesh57_profile_draft_check.py` (accepted layout 3 archive; raw, layout 3 with a pixel stage, layout 2 without one, and a kept +0x78 base within 2 GiB are refused). ## Evidence - Offline: 1524 raw archives of this layout from earlier local runs (159 pipelines, 85 captured in more than one run). The helper gives one normalized descriptor per pipeline; no two pipelines share a variant input. +0x110/+0x270 have a constant high word (0x150) in all of them. - Two captures on a release build of this change on top of #3732's branch (the helper is unchanged by the rebase), `X2W_MESH57_CAPTURE_STATE=1`, same scripted input: 84 and 81 layout 3 archives. All 81 names from the second run were also written by the first; the first run's other 3 belong to pipelines the second run did not create. `read_creation` and the draft accept all 81. - Negative controls: removing the pixel-stage guard in the helper, or using the earlier helper, fails `mesh57_descriptor_relocations`; removing the +0x78 condition or the layout/pixel-stage pairing in the writer fails `tests/mesh57_profile_draft_check.py`. ## Tests ``` ctest --preset dev --no-tests=error -R '^(native_mesh57_outcomes_warp|startup_indirect_mesh_create_result_warp|startup_indirect_mesh57_stream_key_warp|native_fixed_mesh57(_[a-z0-9_]+)?_warp)$' ``` 20/20 passed on `c42b7ce3` + this change (WARP, Windows 11 build 26300). `startup_indirect_mesh_cache_heap_wide_warp` and `native_direct_mesh`, which failed in this PR's first CI run on the older base, also pass locally on the new base. ``` python -B tests/mesh57_profile_draft_check.py python -B tests/docs_links_check.py ``` Both pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
normalize_mesh57_descriptor only removed relocation when the low words at
+0x110/+0x288 and +0x270/+0x120 sat 0x10 apart and the two allocation
addresses were equal. Both depend on where the records are allocated: the
same pipeline passed in one run and failed in the next, so its variant key,
and the name of any reviewed .mesh57-state profile, changed every run.

Recognize the 0x300 layout by its zero and length fields, the two
0x04010000 metadata words and ten record pointers near the +0x38 section
pointer. Make the optional record pointers at +0x198/+0x1b8/+0x1d8/+0x2f8
relative when present, clear both allocation addresses, and keep only the
spacing of the 32-bit values at +0x188/+0x1a8/+0x1c8/+0x2e8.

The fixture replaces the mismatched-allocation control with a wrong
metadata word and adds an unrelated placement, a second-base group (shift,
spacing change, idempotence) and a small metadata value that survives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review of #3730: an optional record pointer equal to the section base
normalized to zero, the value an absent pointer keeps, and the first
second-base value relocated to zero in whichever slot held it. Two
different descriptors then shared a variant and passed the byte checks.
normalize_mesh57_descriptor now stores, in the allocation word at +0x160
that it already dropped, layout version 2 and one bit per optional pointer
and second-base slot that held a relocated value. The descriptor stays
0x300 bytes, so the profile and archive formats are unchanged.

This renames every extended-layout variant. Archives store the normalized
descriptor, so an old one cannot be normalized again: mesh57_profile.py
now refuses an extended descriptor that is raw or lacks the layout 2
word, and asks for a new capture. The runtime looks up only the current
name, so an old profile reports profile_absent without being opened.

Fixtures: the normalization pairs (pointer at base vs absent, second base
in either slot); a raw, an earlier and a current archive through the
writer; and native_mesh57_outcomes with a cache holding only the earlier
profile for one extended record with a second base (not opened,
profile_absent) beside a current profile for another (loads).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Extended descriptors whose +0x38 section pointer is zero keep full process
addresses in their other record pointers, so normalize_mesh57_descriptor
leaves them raw and the profile writer refuses them. Record that this PR
does not cover them (82 of 349 extended archives in one capture) and
that a base for the layout needs a two-run comparison.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Extended fixed descriptors (both 0x04010000 metadata words) with no pixel
stage have +0x30 and the section pointer at +0x38 zero, so
normalize_mesh57_descriptor returned them raw and their variant changed
between runs. Their records keep the same fixed distances from +0x78.

Use +0x78 as the base for that form: the same record, optional and
second-base slots and +0x110/+0x270 low words are made relative, +0x38,
+0x160 and +0x2c0 are cleared and +0x160 carries layout 3 in the presence
word. A zero +0x38 with a pixel stage, or a nonzero one without, stays
raw, and a layout 2 result is never normalized again as layout 3.

The profile writer accepts layout 3 only with an empty pixel stage and
+0x78 and +0x2c0 zero, so a raw allocation address that reads as layout 3
is still refused, and layout 2 now needs a pixel stage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 13:59:44 +00:00
github-bot force-pushed github-bot/gh-3857 from 1a4275201a to 14e2669a75 2026-12-02 23:23:47 +00:00 Compare
github-bot changed target branch from main to gh-pr/3857/base 2026-12-03 00:01:54 +00:00
github manually merged commit 14e2669a75 into gh-pr/3857/base 2026-12-03 00:02:11 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-12-02 23:53 UTC · original · approved these changes

Reviewed 14e2669a. The runtime uses +0x78 as the base only for the mesh-only extended shape. The offline parser ties layout 3 to that shape and rejects a nonzero normalized base. Independent Windows 11 build 26300 / MSVC Debug passed the Python profile-draft test and all seven selected native slot-57 tests (startup_indirect_mesh57_stream_key, startup_indirect_mesh_create_result, native_fixed_mesh57 and its MRT case). Inbox WARP 10.0.26100.9818 and RTX 4060 Laptop 32.0.16.1656 ran with the debug layer enabled. Removing only the +0x78 zero check allowed the raw mesh-only input and failed the fixture's expected refusal. Restoring it passed. Required PR CI is green.

**@⁠R0Y00** on GitHub · 2026-12-02 23:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3857#pullrequestreview-6161190782) · **approved these changes** Reviewed `14e2669a`. The runtime uses +0x78 as the base only for the mesh-only extended shape. The offline parser ties layout 3 to that shape and rejects a nonzero normalized base. Independent Windows 11 build 26300 / MSVC Debug passed the Python profile-draft test and all seven selected native slot-57 tests (`startup_indirect_mesh57_stream_key`, `startup_indirect_mesh_create_result`, `native_fixed_mesh57` and its MRT case). Inbox WARP `10.0.26100.9818` and RTX 4060 Laptop `32.0.16.1656` ran with the debug layer enabled. Removing only the +0x78 zero check allowed the raw mesh-only input and failed the fixture's expected refusal. Restoring it passed. Required PR CI is green.
This discussion has been locked. Commenting is limited to contributors.
No description provided.