tooling: scan slot 57 mesh-layout blocks for the unlocated registers #3891

Manually merged
github merged 4 commits from github-bot/gh-3889 into gh-pr/3889/base 2026-12-02 21:17:36 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-12-02 20:48 UTC · original
Leyukaka:m57-register-scan → main · +548 −0 · 4 files · 4 commits · merged 2026-12-02 21:16 UTC

Problem

A reviewed slot 57 profile needs register fields that no decoder reads yet: the colour write masks, CB_COLOR_CONTROL, the pixel input setup (SPI_PS_INPUT_ADDR / _ENA, SPI_PS_IN_CONTROL), the sample masks, PA_SU_SC_MODE_CNTL and DB_ALPHA_TO_MASK. Their position in the mesh-layout creation blocks is not known. The guest builds state blocks A and B itself, so no source-built pipeline can produce a block with one field changed. The offsets in use today (DB_* at A+0x10C, CB_BLENDn_CONTROL at A+0x124) were found by reading captured blocks against the gfx10 field layouts (#1216, #3505).

This advances the profile work in #3418 (part of #2413), and the open location questions in #1216 (CB_TARGET_MASK) and #1999 item B (PA_SU_SC_MODE_CNTL).

Change

  • tools/startup/mesh57_register_scan.py <request_dir> repeats that comparison over a whole capture corpus without assuming a location. For each register it tests every aligned offset of blocks A and B against a predicate built from the gfx10 field definitions (Mesa src/amd/registers/gfx10.json) and from evidence the capture holds outside the blocks: the pixel program's exports and interpolation, and the .t57 attachment tuple.
  • An offset is reported as located only when every informative variant agrees, at least three variants are informative, its value varies between them, and no other offset survives. A word that is constant across the corpus is never reported as located. Registers resolve in a fixed order, and a located offset is not offered to later rows.
  • Output is offsets and counts only, never captured values or archive names.
  • tests/mesh57_register_scan_check.py (ctest mesh57_register_scan) plants each register in synthetic archives at offsets chosen for the test. Three negative controls: a word moved by one dword in one variant, a corpus whose values never vary, and a corpus without extra bound targets (shader mask and target mask cannot be separated).
  • docs/experiments/native-fixed-mesh57.md gains the section "Locating the remaining mesh-layout registers" with the evidence and result per register.

No runtime code changes. No profile reads the new offsets yet.

Validation

ctest --preset dev --no-tests=error -R '^mesh57_register_scan$'

Passes on Windows (MSVC build tree). The check is source-built and needs no GPU and no capture.

Results so far

Three independent capture corpora, 318 to 330 mesh-layout variants each, default threshold. All three gave the same verdict and the same candidates for every row.

Register Result
CB_COLOR_CONTROL A+0x0D0 in the mesh layout (tag 6, the same base as CB_BLEND at A+0x124): the only offset whose words pass the field test (reserved bits zero, a valid ROP3, CB_NORMAL mode when colour is exported) in all three captures, with three distinct values. A pattern match, not a mutation proof; no field is read yet.
DB_ALPHA_TO_MASK A+0x0B4, provisional: reserved bits only, two distinct words, and the same word also passes the PA_SU_SC_MODE_CNTL predicate
SPI_PS_IN_CONTROL ambiguous, two candidates; A+0x0B0 matched in every informative variant, A+0x00C in about 42 %
CB_SHADER_MASK ambiguous between A+0x0C4 and A+0x0CC
PA_SU_SC_MODE_CNTL ambiguous, five candidates
CB_TARGET_MASK unresolved
SPI_PS_INPUT_ADDR / _ENA unresolved (_ENA depends on _ADDR)
PA_SC_AA_MASK_* unresolved

The evidence is independent of any earlier local measurement: it comes from the public register definitions and from the scan's agreement counts. The repository receives no captured values, no archive names, no keys and no guest data, only the tool, the synthetic check and the offsets above.

Not covered

  • Mesh entry dimensions (threads, vertex and primitive limits, group stride, wave size) are not in these blocks as far as the scan can tell, and the capture holds no independent evidence for them.
  • PA_SC_AA_MASK, PA_SU_SC_MODE_CNTL and DB_ALPHA_TO_MASK have reserved-bit predicates only, so they can stay ambiguous on a real corpus.
  • CB_SHADER_MASK and CB_TARGET_MASK can only be separated by variants that bind more targets than their pixel program exports.
  • Wiring any located offset into the profile tool or the runtime is left to a follow-up, after review of the offsets.

Refs #2413 #3418 #1216

**@⁠Leyukaka** on GitHub · 2026-12-02 20:48 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3889) `Leyukaka:m57-register-scan` → `main` · +548 −0 · 4 files · 4 commits · merged 2026-12-02 21:16 UTC ## Problem A reviewed slot 57 profile needs register fields that no decoder reads yet: the colour write masks, `CB_COLOR_CONTROL`, the pixel input setup (`SPI_PS_INPUT_ADDR` / `_ENA`, `SPI_PS_IN_CONTROL`), the sample masks, `PA_SU_SC_MODE_CNTL` and `DB_ALPHA_TO_MASK`. Their position in the mesh-layout creation blocks is not known. The guest builds state blocks A and B itself, so no source-built pipeline can produce a block with one field changed. The offsets in use today (`DB_*` at A+0x10C, `CB_BLENDn_CONTROL` at A+0x124) were found by reading captured blocks against the gfx10 field layouts (#1216, #3505). This advances the profile work in #3418 (part of #2413), and the open location questions in #1216 (`CB_TARGET_MASK`) and #1999 item B (`PA_SU_SC_MODE_CNTL`). ## Change - `tools/startup/mesh57_register_scan.py <request_dir>` repeats that comparison over a whole capture corpus without assuming a location. For each register it tests every aligned offset of blocks A and B against a predicate built from the gfx10 field definitions (Mesa `src/amd/registers/gfx10.json`) and from evidence the capture holds outside the blocks: the pixel program's exports and interpolation, and the `.t57` attachment tuple. - An offset is reported as located only when every informative variant agrees, at least three variants are informative, its value varies between them, and no other offset survives. A word that is constant across the corpus is never reported as located. Registers resolve in a fixed order, and a located offset is not offered to later rows. - Output is offsets and counts only, never captured values or archive names. - `tests/mesh57_register_scan_check.py` (ctest `mesh57_register_scan`) plants each register in synthetic archives at offsets chosen for the test. Three negative controls: a word moved by one dword in one variant, a corpus whose values never vary, and a corpus without extra bound targets (shader mask and target mask cannot be separated). - `docs/experiments/native-fixed-mesh57.md` gains the section "Locating the remaining mesh-layout registers" with the evidence and result per register. No runtime code changes. No profile reads the new offsets yet. ## Validation ```text ctest --preset dev --no-tests=error -R '^mesh57_register_scan$' ``` Passes on Windows (MSVC build tree). The check is source-built and needs no GPU and no capture. ## Results so far Three independent capture corpora, 318 to 330 mesh-layout variants each, default threshold. All three gave the same verdict and the same candidates for every row. | Register | Result | |---|---| | `CB_COLOR_CONTROL` | A+0x0D0 in the mesh layout (tag 6, the same base as `CB_BLEND` at A+0x124): the only offset whose words pass the field test (reserved bits zero, a valid ROP3, `CB_NORMAL` mode when colour is exported) in all three captures, with three distinct values. A pattern match, not a mutation proof; no field is read yet. | | `DB_ALPHA_TO_MASK` | A+0x0B4, provisional: reserved bits only, two distinct words, and the same word also passes the `PA_SU_SC_MODE_CNTL` predicate | | `SPI_PS_IN_CONTROL` | ambiguous, two candidates; A+0x0B0 matched in every informative variant, A+0x00C in about 42 % | | `CB_SHADER_MASK` | ambiguous between A+0x0C4 and A+0x0CC | | `PA_SU_SC_MODE_CNTL` | ambiguous, five candidates | | `CB_TARGET_MASK` | unresolved | | `SPI_PS_INPUT_ADDR` / `_ENA` | unresolved (`_ENA` depends on `_ADDR`) | | `PA_SC_AA_MASK_*` | unresolved | The evidence is independent of any earlier local measurement: it comes from the public register definitions and from the scan's agreement counts. The repository receives no captured values, no archive names, no keys and no guest data, only the tool, the synthetic check and the offsets above. ## Not covered - Mesh entry dimensions (threads, vertex and primitive limits, group stride, wave size) are not in these blocks as far as the scan can tell, and the capture holds no independent evidence for them. - `PA_SC_AA_MASK`, `PA_SU_SC_MODE_CNTL` and `DB_ALPHA_TO_MASK` have reserved-bit predicates only, so they can stay ambiguous on a real corpus. - `CB_SHADER_MASK` and `CB_TARGET_MASK` can only be separated by variants that bind more targets than their pixel program exports. - Wiring any located offset into the profile tool or the runtime is left to a follow-up, after review of the offsets. Refs #2413 #3418 #1216
State blocks A and B are built by the guest, so a creation block with one
field changed cannot be produced from source. The DB and CB_BLEND offsets
were read off captured blocks against the gfx10 field layouts.

mesh57_register_scan.py does that over a capture corpus without assuming a
location. It tests every aligned offset of both blocks against per-register
predicates tied to evidence outside the blocks (pixel exports and
interpolation contract, the .t57 tuple): CB_SHADER_MASK, CB_COLOR_CONTROL,
CB_TARGET_MASK, SPI_PS_INPUT_ADDR/ENA, SPI_PS_IN_CONTROL, PA_SC_AA_MASK,
PA_SU_SC_MODE_CNTL and DB_ALPHA_TO_MASK. An offset is located only when no
informative variant contradicts it, its value varies and no other offset
survives. Output is offsets and counts only.

The source-built check plants each register in synthetic archives. Its
negative controls are a word shifted by one dword, a constant corpus and a
corpus without extra bound targets. Offsets in the doc table stay
unmeasured until the scan runs on a capture.

Validated: mesh57_register_scan passes; the scanner was run over three private captures (results summarised in the docs commit).
Fill the offset column from three capture corpora: CB_COLOR_CONTROL at
A+0x0D0, DB_ALPHA_TO_MASK at A+0x0B4 (provisional, its word also passes the
PA_SU_SC_MODE_CNTL predicate), the other rows ambiguous or unresolved. Use
neutral "guest" wording in the scan tool, its check and the doc.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 20:52:46 +00:00
Author
Owner

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

Reviewed 87e3ec18. The scan requires variation, enough informative variants and a unique surviving offset. Its synthetic checks pass for planted locations, a moved word, constant values and coincident shader/target masks. I also reproduced an unreadable .t57 stopping the old scan. The follow-up keeps the variant and other independent facts while excluding that attachment evidence, with a source-built regression control. mesh57_register_scan_check.py, mesh57_profile_draft_check.py and docs_links_check.py passed. I independently checked the source-built corpus; the offsets inferred from captured corpora remain candidates for later validation.

**@⁠R0Y00** on GitHub · 2026-12-02 21:08 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3889#pullrequestreview-6159037639) · **approved these changes** Reviewed `87e3ec18`. The scan requires variation, enough informative variants and a unique surviving offset. Its synthetic checks pass for planted locations, a moved word, constant values and coincident shader/target masks. I also reproduced an unreadable `.t57` stopping the old scan. The follow-up keeps the variant and other independent facts while excluding that attachment evidence, with a source-built regression control. `mesh57_register_scan_check.py`, `mesh57_profile_draft_check.py` and `docs_links_check.py` passed. I independently checked the source-built corpus; the offsets inferred from captured corpora remain candidates for later validation.
github-bot changed target branch from main to gh-pr/3889/base 2026-12-02 21:17:35 +00:00
github manually merged commit 87e3ec183c into gh-pr/3889/base 2026-12-02 21:17:36 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.