Pre-build: 852 pipelines skipped as "rasteriser state not named"; the register images name all of them #2930

Open
opened 2026-11-26 05:17:45 +00:00 by github-bot · 4 comments
Owner

@⁠zed6000 on GitHub · 2026-11-26 00:19 UTC · original

What happens

victory translate --cache --pipelines (main 63bcca4, shaders 1.0.2.1, RX 7900 XTX) skips 1,029 of the pack's 28,164 pipelines. 852 of them are skipped: rasteriser state not named:

pipelines    28164 in the pack, 603.5 s: 23380 made, 3755 already in the library
        3  skipped: blend state not named
       24  skipped: compute shader does not translate
      139  skipped: depth-stencil state not named
        1  skipped: pixel shader does not translate
      852  skipped: rasteriser state not named
        8  skipped: shader not found
        2  skipped: stages other than vertex, mesh and pixel

Those 852 records (almost all mesh pipelines, with and without a pixel shader) use only 6 distinct rasteriser hashes; the pack has 18 in all and Named::find names 12. A run still has to compile those 852 pipelines while it plays.

Why

The 6 have slope biases that raster_space doesn't list, and 5 of them also have a non-zero DepthBiasClamp, and pipelines.rs assumes "Rasterisers have no register image here". They do, though. In the same fixed part registers() reads (from 0x74 / 0xc8), the 7 words starting 0x28 are:

Offset in the fixed part Register Maps to the compact description
+0x28 PA_CL_CLIP_CNTL b12 depth clip = both ZCLIP_*_DISABLE bits (26, 27) clear
+0x2c PA_SU_SC_MODE_CNTL b1 cull: CULL_FRONT → 2, CULL_BACK → 3, neither → 1; b2 = FACE clear (ccw)
+0x30, +0x34 (not needed)
+0x38 PA_SU_POLY_OFFSET_CLAMP +4 clamp, as is
+0x3c PA_SU_POLY_OFFSET_FRONT_SCALE +8 slope bias = scale / 16
+0x40 PA_SU_POLY_OFFSET_FRONT_OFFSET b3 bias = offset (an integer)

Fill is solid throughout the pack (POLY_MODE 0). b13 (always 1), b14 and b15 are not in these words, so they're enumerated the way depth_from_registers handles fields it can't see. Every candidate still has to match the record's CityHash64.

I checked this against the pack. For all 24,619 records whose rasteriser Named::find already names, the description read from the registers is the named one in every field. For the 6 unnamed hashes it gives a description whose hash matches.

Effect (measured)

With a raster_from_registers next to depth_from_registers/blend_from_registers, run from name_from_registers:

  • All 18 rasteriser hashes are named (3 from the databases, 15 from the registers, none left to raster_space). Records with all three states named go from 24,477 to 25,329 of 25,471. Named::find takes about the same time (~85 ms).
  • translate --cache --pipelines on the same library: rasteriser state not named disappears (852 → 0). 447 pipelines were made, the rest of the 852 records were found in the library, and nothing was refused. The remaining skips are the 139 depth-stencil and 3 blend states, plus the shader causes.
  • One of the newly named pipelines is in the early list (early-pipelines.txt) of an earlier run of the game on this machine, under the same key. The key includes the whole D3D12 rasteriser description, so that pipeline's derived description matches what the engine handed the device at run time, byte for byte.
  • cargo test -p victory-game passes (17/0, including two new tests). cargo clippy -p victory-game -p victory --all-targets --locked -- -D warnings is clean.

It doesn't conflict in purpose with #2575 / #2787 (stopping the enumerations once nothing is wanted). With every rasteriser named from the registers, raster_space would stop at once there.

I have this as a ~135-line patch to crates/victory-game/src/pipelines.rs (the derivation, the doc comment's numbers, two unit tests) and can open it as a PR if that's welcome. Or it's small enough to take from the table above.

Offline measurement and pipeline creation only; no shader names, hashes or game data.

**@⁠zed6000** on GitHub · 2026-11-26 00:19 UTC · [original](https://github.com/Marvisak/VIctory/issues/2930) ### What happens `victory translate --cache --pipelines` (main `63bcca4`, shaders 1.0.2.1, RX 7900 XTX) skips 1,029 of the pack's 28,164 pipelines. 852 of them are `skipped: rasteriser state not named`: ``` pipelines 28164 in the pack, 603.5 s: 23380 made, 3755 already in the library 3 skipped: blend state not named 24 skipped: compute shader does not translate 139 skipped: depth-stencil state not named 1 skipped: pixel shader does not translate 852 skipped: rasteriser state not named 8 skipped: shader not found 2 skipped: stages other than vertex, mesh and pixel ``` Those 852 records (almost all mesh pipelines, with and without a pixel shader) use only **6 distinct rasteriser hashes**; the pack has 18 in all and `Named::find` names 12. A run still has to compile those 852 pipelines while it plays. ### Why The 6 have slope biases that `raster_space` doesn't list, and 5 of them also have a non-zero `DepthBiasClamp`, and `pipelines.rs` assumes "Rasterisers have no register image here". They do, though. In the same fixed part `registers()` reads (from `0x74` / `0xc8`), the 7 words starting **`0x28`** are: | Offset in the fixed part | Register | Maps to the compact description | |---|---|---| | `+0x28` | `PA_CL_CLIP_CNTL` | b12 depth clip = both `ZCLIP_*_DISABLE` bits (26, 27) clear | | `+0x2c` | `PA_SU_SC_MODE_CNTL` | b1 cull: `CULL_FRONT` → 2, `CULL_BACK` → 3, neither → 1; b2 = `FACE` clear (ccw) | | `+0x30`, `+0x34` | (not needed) | | | `+0x38` | `PA_SU_POLY_OFFSET_CLAMP` | +4 clamp, as is | | `+0x3c` | `PA_SU_POLY_OFFSET_FRONT_SCALE` | +8 slope bias = scale / 16 | | `+0x40` | `PA_SU_POLY_OFFSET_FRONT_OFFSET` | b3 bias = offset (an integer) | Fill is solid throughout the pack (`POLY_MODE` 0). b13 (always 1), b14 and b15 are not in these words, so they're enumerated the way `depth_from_registers` handles fields it can't see. Every candidate still has to match the record's CityHash64. I checked this against the pack. For all **24,619 records whose rasteriser `Named::find` already names**, the description read from the registers is the named one in every field. For the 6 unnamed hashes it gives a description whose hash matches. ### Effect (measured) With a `raster_from_registers` next to `depth_from_registers`/`blend_from_registers`, run from `name_from_registers`: - All 18 rasteriser hashes are named (3 from the databases, 15 from the registers, none left to `raster_space`). Records with all three states named go from **24,477 to 25,329** of 25,471. `Named::find` takes about the same time (~85 ms). - `translate --cache --pipelines` on the same library: **`rasteriser state not named` disappears** (852 → 0). 447 pipelines were made, the rest of the 852 records were found in the library, and nothing was refused. The remaining skips are the 139 depth-stencil and 3 blend states, plus the shader causes. - One of the newly named pipelines is in the early list (`early-pipelines.txt`) of an earlier run of the game on this machine, under the same key. The key includes the whole D3D12 rasteriser description, so that pipeline's derived description matches what the engine handed the device at run time, byte for byte. - `cargo test -p victory-game` passes (17/0, including two new tests). `cargo clippy -p victory-game -p victory --all-targets --locked -- -D warnings` is clean. It doesn't conflict in purpose with #2575 / #2787 (stopping the enumerations once nothing is wanted). With every rasteriser named from the registers, `raster_space` would stop at once there. I have this as a ~135-line patch to `crates/victory-game/src/pipelines.rs` (the derivation, the doc comment's numbers, two unit tests) and can open it as a PR if that's welcome. Or it's small enough to take from the table above. Offline measurement and pipeline creation only; no shader names, hashes or game data.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:17:45 +00:00
Author
Owner

@⁠zed6000 on GitHub · 2026-11-26 00:25 UTC · original

Follow-up: the same approach covers almost all of the 139 depth-stencil state not named records too. They use 13 hashes. Comparing what depth_from_registers produces with the descriptions that do match shows three things the registers don't keep:

  • b14 and b15 (the depth-bounds test). Several states have b15 = 1 while DB_DEPTH_CONTROL's DEPTH_BOUNDS_ENABLE is clear, and two have b14 = 1 (a byte the layout comment doesn't list yet). Both are tried as 0 and 1.
  • The write mask of a stencil that can write nothing. With stencil on and keep everywhere, DB_STENCILREFMASK holds write mask 0 where the description has 0xFF (or the read mask). Those are tried too.
  • A disabled stencil's ops and funcs. With STENCIL_ENABLE clear, DB_DEPTH_CONTROL / DB_STENCIL_CONTROL still hold the funcs and ops the engine's description names. The faces read from them are tried next to the D3D12 default faces.

All are only candidates, so the CityHash64 still decides. Result on the pack:

  • 11 of the 13 hashes are named (136 of 139 records). All three states are named for 25,465 of 25,471 records (24,477 on main), and Named::find still takes ~88 ms.
  • translate --cache --pipelines now skips 41 of 28,164 pipelines instead of 1,029: 3 depth-stencil, 3 blend, and the 35 shader causes (24 compute shaders that don't translate, 8 not found, 2 other stages, 1 pixel shader). Every pipeline it made was created; nothing was refused.
  • cargo test -p victory-game is 18/0 (plus a test for these cases), and clippy is clean.

The two that are still unnamed (3 records) both have depth on and a stencil whose registers keep nothing it writes. A wider search over every op and func of both faces didn't match them either, so something else differs there.

Both changes together are about 220 lines in crates/victory-game/src/pipelines.rs, and I'm happy to open them as a PR. Offline measurement and pipeline creation only; no names, hashes or game data.

**@⁠zed6000** on GitHub · 2026-11-26 00:25 UTC · [original](https://github.com/Marvisak/VIctory/issues/2930#issuecomment-7178746127) Follow-up: the same approach covers almost all of the **139 `depth-stencil state not named`** records too. They use 13 hashes. Comparing what `depth_from_registers` produces with the descriptions that do match shows three things the registers don't keep: - **b14 and b15 (the depth-bounds test).** Several states have b15 = 1 while `DB_DEPTH_CONTROL`'s `DEPTH_BOUNDS_ENABLE` is clear, and two have b14 = 1 (a byte the layout comment doesn't list yet). Both are tried as 0 and 1. - **The write mask of a stencil that can write nothing.** With stencil on and keep everywhere, `DB_STENCILREFMASK` holds write mask 0 where the description has 0xFF (or the read mask). Those are tried too. - **A disabled stencil's ops and funcs.** With `STENCIL_ENABLE` clear, `DB_DEPTH_CONTROL` / `DB_STENCIL_CONTROL` still hold the funcs and ops the engine's description names. The faces read from them are tried next to the D3D12 default faces. All are only candidates, so the CityHash64 still decides. Result on the pack: - **11 of the 13 hashes** are named (136 of 139 records). All three states are named for **25,465 of 25,471 records** (24,477 on `main`), and `Named::find` still takes ~88 ms. - `translate --cache --pipelines` now skips **41 of 28,164** pipelines instead of 1,029: 3 depth-stencil, 3 blend, and the 35 shader causes (24 compute shaders that don't translate, 8 not found, 2 other stages, 1 pixel shader). Every pipeline it made was created; nothing was refused. - `cargo test -p victory-game` is 18/0 (plus a test for these cases), and clippy is clean. The two that are still unnamed (3 records) both have depth on and a stencil whose registers keep nothing it writes. A wider search over every op and func of both faces didn't match them either, so something else differs there. Both changes together are about 220 lines in `crates/victory-game/src/pipelines.rs`, and I'm happy to open them as a PR. Offline measurement and pipeline creation only; no names, hashes or game data.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 00:28 UTC · original

The register-to-description table matches the raster_space field layout, and the verification is airtight — 24,619 records already-named all agreeing field-for-field, plus the 852→0 measured result, is stronger evidence than most PRs arrive with. Please do open the patch as a PR: the *_from_registers pattern already has precedent in depth_from_registers/blend_from_registers, so the shape fits. The depth-stencil follow-up (unknown bits enumerated, CityHash64 still checked) is the same trick extended — worth its own PR after this one lands so each stays reviewable.

**@⁠kotekompotek** on GitHub · 2026-11-26 00:28 UTC · [original](https://github.com/Marvisak/VIctory/issues/2930#issuecomment-7178794268) The register-to-description table matches the `raster_space` field layout, and the verification is airtight — 24,619 records already-named all agreeing field-for-field, plus the 852→0 measured result, is stronger evidence than most PRs arrive with. Please do open the patch as a PR: the `*_from_registers` pattern already has precedent in `depth_from_registers`/`blend_from_registers`, so the shape fits. The depth-stencil follow-up (unknown bits enumerated, CityHash64 still checked) is the same trick extended — worth its own PR after this one lands so each stays reviewable.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 00:42 UTC · original · edited 2026-11-26 06:42 UTC

Automated triage for the maintainers.

The premise matches main: in crates/victory-game/src/pipelines.rs, name_from_registers derives depth and blend states from the register images (depth_from_registers, blend_from_registers), while rasterisers are left to the enumeration in raster_space, with the comment "Rasterisers have no register image here". A raster_from_registers alongside them, as proposed, fits the existing pattern, and the CityHash64 check still decides every candidate.

The changes are now open as pull requests: #3047 (rasterisers from the register images) and #3048 (the depth-stencil follow-up, stacked on #3047). The decision is left to the maintainers; review continues there.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 00:42 UTC · [original](https://github.com/Marvisak/VIctory/issues/2930#issuecomment-7179030893) · edited 2026-11-26 06:42 UTC <!-- victory-issue-triage v1 verdict=tracked seen=2026-11-26T05:15:18Z at=2026-11-26T06:44:00Z --> Automated triage for the maintainers. The premise matches `main`: in `crates/victory-game/src/pipelines.rs`, `name_from_registers` derives depth and blend states from the register images (`depth_from_registers`, `blend_from_registers`), while rasterisers are left to the enumeration in `raster_space`, with the comment "Rasterisers have no register image here". A `raster_from_registers` alongside them, as proposed, fits the existing pattern, and the CityHash64 check still decides every candidate. The changes are now open as pull requests: #3047 (rasterisers from the register images) and #3048 (the depth-stencil follow-up, stacked on #3047). The decision is left to the maintainers; review continues there. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠zed6000 on GitHub · 2026-11-26 05:15 UTC · original

Opened as asked, as two PRs:

  • #3047: rasterisers from the register images (rasteriser state not named 852 → 0).
  • #3048: the depth-stencil follow-up (139 → 3 records), stacked on #3047. Its own change is the second commit.

Together they take the pre-build from 1,029 skipped pipelines to 41 on 63bcca4. The measurements are in the PR descriptions and above.

**@⁠zed6000** on GitHub · 2026-11-26 05:15 UTC · [original](https://github.com/Marvisak/VIctory/issues/2930#issuecomment-7183320618) Opened as asked, as two PRs: - **#3047**: rasterisers from the register images (`rasteriser state not named` 852 → 0). - **#3048**: the depth-stencil follow-up (139 → 3 records), stacked on #3047. Its own change is the second commit. Together they take the pre-build from 1,029 skipped pipelines to 41 on `63bcca4`. The measurements are in the PR descriptions and above.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#2930
No description provided.