Skip to content

vs_layout_census: confirm the VS input layout is legacy non-NGG per PAL hardware stage; measure the 195 ES variants - #6558

Open
abilliontokens wants to merge 1 commit into
ItsNotRexed:mainfrom
abilliontokens:vs-input-layout
Open

abilliontokens wants to merge 1 commit into
ItsNotRexed:mainfrom
abilliontokens:vs-input-layout

Conversation

@abilliontokens

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #6214 (comment) (README bullet: "the vertex-shader input layout (v0 = VertexIndex is unverified if the console runs VS as NGG)")

Depends on: none — builds on merged #4347 (tools/pal_stages.py) and #436 (scripts/vs_input_survey.py); no open PR touches these files. The README bullet itself is edited by #4118 (README only, no overlap).

What and why

The README bullet asks whether the console runs the vertex shader as NGG (which would put the VS inputs at v5/v8 and make v0 = VertexIndex wrong). This PR answers it with a census over every tag-0x0D payload of the 1.0.2.1 corpus, joined with the PAL hardware-stage record of each payload:

  • scripts/vs_layout_census.py (new): for each container's payloads, reads the PAL stage record (tools/pal_stages.py), the carve-index stage, the code markers (NGG exp prim / s_sendmsg MSG_GS_ALLOC_REQ / v_mbcnt, exp pos0/param, the fetch call) and, for API-VS payloads, the entry VGPRs read before written (scripts/vs_input_survey.read_before_write). The .s listing covers each container's last payload (the one fssm_unpack.py translates); unlisted payloads are disassembled with llvm-mc. Counts only, --json for the full table.
  • tests/test_vs_layout_census.py (new): 5 tests on hand-built DXBC/FSSM containers (synthetic bytes only).
  • docs/design.md: two contract rows (VS input layout, per PAL hardware stage, VS as ES (two-payload VS containers)) and a cross-reference in PAL stage descriptors.
  • docs/fssm_crosscheck.md: the two-payload selection unknown now records the measured hardware-stage split.

Corpus counts (1.0.2.1, 26,503 containers / 26,698 payloads)

  • stage-4 (VS): 2,236 payloads — all legacy non-NGG (no exp prim, no s_sendmsg, no v_mbcnt), every one exports pos0 and param. So v0 = VertexIndex (zero-based, DrawParameters) is confirmed, not NGG.
  • stage-7 (NGG/mesh): 9,282 — every one carries all three NGG markers.
  • stage-3 (GS): 195 — s_sendmsg MSG_GS_OP_* + v_mbcnt, no position export.
  • stage-2 (ES): 195 — the first payload of the 195 two-payload $VS_VoxelizeGeneric containers: no exp (vertex outputs go to LDS for the GS), v_mbcnt lane id, entry read-before-write VGPRs v5, v9–v11, v13–v14 (never v0/v3), no fetch call. fssm_unpack.py defaults to the last payload, so the ES variant is untranslated; which payload a GS-bound pipeline selects is still open.
  • PS 12,101 / CS 2,689: v_mbcnt in 332 / 266, s_sendmsg in 10 PS, no exp prim.

Tested

Commit b68703ac0 (rebased on origin/main 1cc6e3c12). No translator change, so there is no translate/spirv-val before-and-after: this is a static count over the carved corpus.

$ python -I tests/test_vs_layout_census.py
Ran 5 tests
OK

$ python -I tests/test_pal_stages.py
Ran 17 tests
OK

$ python -I tests/test_vs_input_survey.py
test_vs_input_survey: OK (0 failures)

$ for t in tests/test_docs_design_rows.py tests/test_docs_table_rows.py tests/test_docs_repo_paths.py tests/test_docs_links.py tests/test_docs_repeated_lines.py; do python -I $t; done
OK (each)

Full-corpus census (CPU only, 735 s): python -I scripts/vs_layout_census.py <work>/shaders/dxbc --json vs_layout_census.json: 26,503 containers, 26,698 payloads, 0 without a PAL record, 0 API-stage mismatches, 195 unlisted payloads disassembled. As a cross-check, a separate scan of the 26,503 listings for s_sendmsg found it only in hardware stages 3 (195), 5 (10) and 7 (9,282), the same as the census.

Windows 11 (10.0.26200), Python 3.12.10, CPU only: no GPU or driver involved.

AI-assisted: yes (omp orchestrator).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

…easure the 195 ES variants

scripts/vs_layout_census.py joins every tag-0x0D payload's PAL stage record
(tools/pal_stages.py) with its code markers over the whole carve index, plus
the entry VGPRs read before written for API-VS payloads. Over 1.0.2.1
(26,503 containers, 26,698 payloads): all 2,236 stage-4 VS payloads are
legacy non-NGG (no exp prim / s_sendmsg / v_mbcnt, all export pos0+param),
so v0 = VertexIndex (zero-based) is confirmed, not NGG; the 9,282 stage-7
payloads are the NGG/mesh ones. The 195 stage-2 payloads are the ES variants
of the two-payload $VS_VoxelizeGeneric containers (no exp, LDS writes,
v_mbcnt, entry VGPRs v5/v9-v11/v13-v14), which fssm_unpack's last-payload
default leaves untranslated.

docs/design.md gains the two contract rows and a PAL-stage cross-reference;
docs/fssm_crosscheck.md records the measured hardware-stage split for the
two-payload selection unknown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant