tooling: draft reviewed slot 57 profiles from captures #3724

Merged
lambirou merged 1 commit from upstream-pr/3724 into main 2026-12-01 11:22:51 +00:00
lambirou commented 2026-12-01 10:55:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lambirou on 2026-12-01T10:55:40Z.


Refs #3505 #3493 #3502 #870

Why

A reviewed slot 57 profile still has to be written by hand. A long local run left 437 .s57 captures but no .mesh57-state for the color pipelines, so the first color key cannot be reviewed. The capture holds the mesh-layout depth-stencil and blend words; the .t57 sidecar (#3502) holds the ordered RTV formats, DSV and sample description. The tool should prefill exactly those and leave the rest to a reviewer.

What

  • tools/startup/mesh57_profile_draft.py (new): --draft, --check, --census.
    • Decodes DB_DEPTH_CONTROL, DB_STENCIL_CONTROL and DB_STENCILREFMASK(_BF) at A+0x10C with the rules of pipeline_state_decode.h.
    • Decodes the eight CB_BLENDn_CONTROL words at A+0x124 with cb_blend.h / state_block_blend.h, including the dual-source, BOTH_SRC_ALPHA, alpha-factor and MIN/MAX refusals.
    • Reads one distinct .t57 tuple; refuses conflicting tuples, an overflow line and malformed lines.
    • Classifies the pixel stage from its EXP targets (mrt0..mrt7 = color, mrtz, null, none) and refuses a stage/attachment pair that cannot describe the same pipeline.
    • Leaves mesh dimensions, rasterizer, pixel entry, root mappings and version null with per-field provenance; writes review_required and a byte-free capture summary.
  • mesh57_profile.py:
    • --draft, --check and --census dispatch.
    • The writer lists every unreviewed null field at once (profile is incomplete: ...), refuses the review metadata, and refuses a reviewed state that disagrees with a decoded capture value.
    • Depth-only writer support: empty .ps57, zero RTV/blend, enabled depth writes, typed DSV, zeroed pixel for versions 2–5, version 6 refused.
  • Documentation plus a CTest fragment and Linux check-list entry.

Evidence

Commands from the worktree, Release preset, MSVC 19.44 and Windows SDK DXC 10.0.26100.0:

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

ctest --preset release --no-tests=error -R '^mesh57_profile_draft$' --output-on-failure
1/1 passed

ctest --preset release --no-tests=error -R '^(native_direct_mesh|startup_mesh57_real_shape|mesh57_profile_draft|startup_pipeline_state|startup_cb_blend_decode|startup_state_block_blend)$' --output-on-failure
6/6 passed (no skips)

The fixture is source-built: triangle() from native_direct_mesh_check.py, the four-word exp mrt0 pixel from startup_mesh57_real_shape_check.py, the null-export pixel from startup_mesh57_depth_only_check.py, and VALID_ROOT from startup_gfx2hlsl_root_check.py. The optional CTest arguments run compile_dxil gfx1013-raw-mesh-ps on the reviewed meshps1 0 0 64 entry and assert a DXBC output.

Local capture census (read-only cache; no bytes copied or committed):

captures 437: color 239, depth 77, null 25, param 0, none 1, empty 95, refused 0
sidecars 0, attachment tuples 0, consistent stage/attachment pairs 0

A drafted color capture preserves its color-target indices and decoded depth words, but leaves rt_formats, depth_format, samples, blend, mesh, rasterizer, pixel and version null. --check exits 1 and names all of them; no profile is written.

Mutation: with capture != reviewed disabled in capture_mismatches, the mismatch case accepts an edited depth_stencil.depth_func and the test fails (profile complete instead of the refusal); restored.

Limits / blocker

  • No color-capable key was published. The local cache has 0 .t57 sidecars, so the ordered RTV formats, DSV and sample description of the 239 color-capable captures are unknown. A profile would require inventing those values. This needs #3502 (or equivalent capture evidence) in the run.
  • Mesh dimensions, rasterizer state, pixel entry, root mappings and version are not located in the capture; a reviewer must supply them.
  • The writer keeps the existing sample restriction (count 1, quality 0); a captured multisample tuple is drafted but cannot be written.
  • The four existing reviewed depth-only profiles use a canonical depth state (ALWAYS, stencil off) that differs from the decoded depth words (GREATER, stencil on). They are unchanged; this writer would refuse to re-author them with the same header. New profiles must keep the decoded depth-stencil.
  • The runtime on main still refuses PS-less creation before the profile lookup; depth-only authoring is for the #3493 path.

No game files, game bytes, GDK files or borrowed GPL code are included.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5584235701 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3724). Originally posted by [lambirou](https://github.com/lambirou) on 2026-12-01T10:55:40Z. --- Refs #3505 #3493 #3502 #870 ## Why A reviewed slot 57 profile still has to be written by hand. A long local run left 437 `.s57` captures but no `.mesh57-state` for the color pipelines, so the first color key cannot be reviewed. The capture holds the mesh-layout depth-stencil and blend words; the `.t57` sidecar (#3502) holds the ordered RTV formats, DSV and sample description. The tool should prefill exactly those and leave the rest to a reviewer. ## What - `tools/startup/mesh57_profile_draft.py` (new): `--draft`, `--check`, `--census`. - Decodes `DB_DEPTH_CONTROL`, `DB_STENCIL_CONTROL` and `DB_STENCILREFMASK(_BF)` at `A+0x10C` with the rules of `pipeline_state_decode.h`. - Decodes the eight `CB_BLENDn_CONTROL` words at `A+0x124` with `cb_blend.h` / `state_block_blend.h`, including the dual-source, `BOTH_SRC_ALPHA`, alpha-factor and MIN/MAX refusals. - Reads one distinct `.t57` tuple; refuses conflicting tuples, an overflow line and malformed lines. - Classifies the pixel stage from its EXP targets (`mrt0..mrt7` = color, `mrtz`, `null`, none) and refuses a stage/attachment pair that cannot describe the same pipeline. - Leaves mesh dimensions, rasterizer, pixel entry, root mappings and version null with per-field provenance; writes `review_required` and a byte-free capture summary. - `mesh57_profile.py`: - `--draft`, `--check` and `--census` dispatch. - The writer lists every unreviewed null field at once (`profile is incomplete: ...`), refuses the review metadata, and refuses a reviewed state that disagrees with a decoded capture value. - Depth-only writer support: empty `.ps57`, zero RTV/blend, enabled depth writes, typed DSV, zeroed pixel for versions 2–5, version 6 refused. - Documentation plus a CTest fragment and Linux check-list entry. ## Evidence Commands from the worktree, Release preset, MSVC 19.44 and Windows SDK DXC 10.0.26100.0: ```text python -B tests/mesh57_profile_draft_check.py slot 57 profile draft, review, depth-only and refusal checks passed ctest --preset release --no-tests=error -R '^mesh57_profile_draft$' --output-on-failure 1/1 passed ctest --preset release --no-tests=error -R '^(native_direct_mesh|startup_mesh57_real_shape|mesh57_profile_draft|startup_pipeline_state|startup_cb_blend_decode|startup_state_block_blend)$' --output-on-failure 6/6 passed (no skips) ``` The fixture is source-built: `triangle()` from `native_direct_mesh_check.py`, the four-word `exp mrt0` pixel from `startup_mesh57_real_shape_check.py`, the null-export pixel from `startup_mesh57_depth_only_check.py`, and `VALID_ROOT` from `startup_gfx2hlsl_root_check.py`. The optional CTest arguments run `compile_dxil gfx1013-raw-mesh-ps` on the reviewed `meshps1 0 0 64` entry and assert a DXBC output. Local capture census (read-only cache; no bytes copied or committed): ```text captures 437: color 239, depth 77, null 25, param 0, none 1, empty 95, refused 0 sidecars 0, attachment tuples 0, consistent stage/attachment pairs 0 ``` A drafted color capture preserves its color-target indices and decoded depth words, but leaves `rt_formats`, `depth_format`, `samples`, `blend`, `mesh`, `rasterizer`, `pixel` and `version` null. `--check` exits 1 and names all of them; no profile is written. Mutation: with `capture != reviewed` disabled in `capture_mismatches`, the mismatch case accepts an edited `depth_stencil.depth_func` and the test fails (`profile complete` instead of the refusal); restored. ## Limits / blocker - No color-capable key was published. The local cache has 0 `.t57` sidecars, so the ordered RTV formats, DSV and sample description of the 239 color-capable captures are unknown. A profile would require inventing those values. This needs #3502 (or equivalent capture evidence) in the run. - Mesh dimensions, rasterizer state, pixel entry, root mappings and version are not located in the capture; a reviewer must supply them. - The writer keeps the existing sample restriction (`count 1`, `quality 0`); a captured multisample tuple is drafted but cannot be written. - The four existing reviewed depth-only profiles use a canonical depth state (ALWAYS, stencil off) that differs from the decoded depth words (GREATER, stencil on). They are unchanged; this writer would refuse to re-author them with the same header. New profiles must keep the decoded depth-stencil. - The runtime on main still refuses PS-less creation before the profile lookup; depth-only authoring is for the #3493 path. No game files, game bytes, GDK files or borrowed GPL code are included.
R0Y00 commented 2026-12-01 11:22:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-01T11:22:47Z.

Review: APPROVED


Reviewed the capture-derived draft, preservation of unresolved fields, duplicate-key refusal and the explicit reviewed-profile check. The local mesh57_profile_draft_check.py passed with compile_dxil and Windows SDK DXC, including the depth-only profile and refusal controls.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6130229578 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3724#pullrequestreview-6130229578). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-01T11:22:47Z. **Review:** APPROVED --- Reviewed the capture-derived draft, preservation of unresolved fields, duplicate-key refusal and the explicit reviewed-profile check. The local mesh57_profile_draft_check.py passed with compile_dxil and Windows SDK DXC, including the depth-only profile and refusal controls.
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!3724
No description provided.