Game: try what depth-stencil registers do not keep (stacked on #3047) #3048

Open
github-bot wants to merge 2 commits from github-bot/gh-3048 into main AGit
Owner

@⁠zed6000 on GitHub · 2026-11-26 05:14 UTC · original
zed6000:pr-depth-registers → main · +222 −21 · 1 files · 2 commits · open

The depth-stencil half of #2930. Stacked on #3047: the first commit here is #3047's, and this PR's own change is the second commit (1d5afa0). Once #3047 is in, only that commit remains.

After rasterisers, the pre-build's largest named-state gap is 139 records (13 hashes) with depth-stencil state not named. Comparing depth_from_registers's candidates with the descriptions that do match shows three things the registers don't keep:

  • b14 and b15 (the depth-bounds test): set in several descriptions while DEPTH_BOUNDS_ENABLE is clear. Both are now tried as 0 and 1.
  • The write mask of a stencil that can write nothing: with stencil on and keep everywhere, DB_STENCILREFMASK holds 0 where the description has 0xFF (or the read mask). Both are tried.
  • A disabled stencil's ops and funcs: with STENCIL_ENABLE clear, DB_DEPTH_CONTROL / DB_STENCIL_CONTROL still hold the faces the engine's description names. They are tried next to the D3D12 default faces.

depth_from_registers now wraps the old body (depth_kept) and adds those variants. The face decoding moved to stencil_faces so both use it. The CityHash64 still decides.

Measured on shaders.rpf 1.0.2.1 (offline, RX 7900 XTX):

  • 11 of the 13 hashes are named (136 of 139 records), all from the registers; the enumeration names none now. Records with all three states named go from 25,329 to 25,465 of 25,471. Named::find takes ~88 ms.
  • translate --cache --pipelines skips 41 of 28,164 pipelines (main: 1,029): 3 depth-stencil, 3 blend, and the 35 shader causes. Every pipeline it made was created.
  • cargo test -p victory-game 18/0 (1 new test, on synthetic registers), and clippy clean.

The 2 hashes still unnamed (3 records) have depth on and a stencil whose registers keep nothing it writes. A search over every op and func of both faces didn't match them, so they're left alone.

🤖 Generated with Claude Code

**@⁠zed6000** on GitHub · 2026-11-26 05:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/3048) `zed6000:pr-depth-registers` → `main` · +222 −21 · 1 files · 2 commits · open The depth-stencil half of #2930. **Stacked on #3047:** the first commit here is #3047's, and this PR's own change is the second commit (`1d5afa0`). Once #3047 is in, only that commit remains. After rasterisers, the pre-build's largest named-state gap is 139 records (13 hashes) with `depth-stencil state not named`. Comparing `depth_from_registers`'s candidates with the descriptions that do match shows three things the registers don't keep: - **b14 and b15 (the depth-bounds test):** set in several descriptions while `DEPTH_BOUNDS_ENABLE` is clear. Both are now tried as 0 and 1. - **The write mask of a stencil that can write nothing:** with stencil on and keep everywhere, `DB_STENCILREFMASK` holds 0 where the description has 0xFF (or the read mask). Both are tried. - **A disabled stencil's ops and funcs:** with `STENCIL_ENABLE` clear, `DB_DEPTH_CONTROL` / `DB_STENCIL_CONTROL` still hold the faces the engine's description names. They are tried next to the D3D12 default faces. `depth_from_registers` now wraps the old body (`depth_kept`) and adds those variants. The face decoding moved to `stencil_faces` so both use it. The CityHash64 still decides. Measured on `shaders.rpf` 1.0.2.1 (offline, RX 7900 XTX): - 11 of the 13 hashes are named (136 of 139 records), all from the registers; the enumeration names none now. Records with all three states named go from 25,329 to 25,465 of 25,471. `Named::find` takes ~88 ms. - `translate --cache --pipelines` skips 41 of 28,164 pipelines (`main`: 1,029): 3 depth-stencil, 3 blend, and the 35 shader causes. Every pipeline it made was created. - `cargo test -p victory-game` 18/0 (1 new test, on synthetic registers), and clippy clean. The 2 hashes still unnamed (3 records) have depth on and a stencil whose registers keep nothing it writes. A search over every op and func of both faces didn't match them, so they're left alone. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The pack's register images keep the rasteriser registers 0x28 bytes into
the fixed part (PA_CL_CLIP_CNTL, PA_SU_SC_MODE_CNTL, the poly-offset
clamp, front scale and front offset). Reading cull, winding, depth clip,
clamp, slope (scale / 16) and bias from them names every rasteriser hash
of the pack, including six whose clamped, fractional slope biases no
enumeration reached: all three states of 25,329 of 25,471 records are
named instead of 24,477, so the pre-build makes 852 more pipelines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The register images leave out b14 and the depth-bounds test (b15), keep
the write mask of a stencil that can write nothing as 0, and still hold
the ops and funcs of a stencil that is off, which the engine's
descriptions name. Trying those as well names 11 of the 13 depth-stencil
hashes the pack's records had unnamed (136 of 139 records): all three
states of 25,465 of 25,471 records are named, and the pre-build skips 41
of 28,164 pipelines instead of 1,029.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:27:30 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 06:17 UTC · original

Automated triage for the maintainers.

Verdict: merge candidate, after #3047. The PR's first commit is #3047's. The only change of its own is 1d5afa0 in crates/victory-game/src/pipelines.rs. depth_from_registers now wraps the old body (renamed depth_kept) and also tries:

  • b14 and b15 (the depth-bounds test) as 0 and 1,
  • a write mask of 0xFF or the read mask when stencil is on and the register mask is 0,
  • for a disabled stencil, the faces that DB_STENCIL_CONTROL/DB_DEPTH_CONTROL still hold.

The face decoding is moved unchanged into stencil_faces. A candidate still counts only when its CityHash64 matches the record's, so the extra variants cannot name a wrong state. The search stays small, at most a few hundred candidates per register image.

Note for the maintainer: #3040 also changes depth_from_registers and depth_space to recover the depth-bounds bit (b15), and the two will conflict textually. This PR covers b15 in the register path more broadly. #3040 also adds b15 to the enumeration and checks the stream output. Pick one, or rebase the other.

CI: check passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 06:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/3048#issuecomment-7184279510) <!-- victory-triage v1 head=1d5afa02d77f0faa3492a651882f369f3c7a725a verdict=merge-candidate at=2026-11-26T06:17:30Z --> Automated triage for the maintainers. **Verdict: merge candidate, after #3047.** The PR's first commit is #3047's. The only change of its own is `1d5afa0` in `crates/victory-game/src/pipelines.rs`. `depth_from_registers` now wraps the old body (renamed `depth_kept`) and also tries: - b14 and b15 (the depth-bounds test) as 0 and 1, - a write mask of 0xFF or the read mask when stencil is on and the register mask is 0, - for a disabled stencil, the faces that `DB_STENCIL_CONTROL`/`DB_DEPTH_CONTROL` still hold. The face decoding is moved unchanged into `stencil_faces`. A candidate still counts only when its CityHash64 matches the record's, so the extra variants cannot name a wrong state. The search stays small, at most a few hundred candidates per register image. Note for the maintainer: #3040 also changes `depth_from_registers` and `depth_space` to recover the depth-bounds bit (b15), and the two will conflict textually. This PR covers b15 in the register path more broadly. #3040 also adds b15 to the enumeration and checks the stream output. Pick one, or rebase the other. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 05:20 UTC · original · approved these changes

Static review of commit 1d5afa02 (stacked on #3047) in crates/victory-game/src/pipelines.rs.

depth_from_registers cleanly wraps depth_kept and tries the four combinations of (b[14], b[15]), the 0xFF / read-mask write-mask variants when DB_STENCILREFMASK has write mask 0 with stencil enabled, and the register-encoded stencil faces when STENCIL_ENABLE is clear. Trying (b[14], b[15]) unconditionally also catches descriptions that enable depth bounds even when DB_DEPTH_CONTROL bit 3 is clear, and CityHash64 remains the exact arbiter. Clean factoring via stencil_faces and clear unit tests.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 05:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/3048#pullrequestreview-6068932748) · **approved these changes** Static review of commit `1d5afa02` (stacked on #3047) in `crates/victory-game/src/pipelines.rs`. `depth_from_registers` cleanly wraps `depth_kept` and tries the four combinations of `(b[14], b[15])`, the `0xFF` / read-mask write-mask variants when `DB_STENCILREFMASK` has write mask 0 with stencil enabled, and the register-encoded stencil faces when `STENCIL_ENABLE` is clear. Trying `(b[14], b[15])` unconditionally also catches descriptions that enable depth bounds even when `DB_DEPTH_CONTROL` bit 3 is clear, and CityHash64 remains the exact arbiter. Clean factoring via `stencil_faces` and clear unit tests.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-26 05:27 UTC · original · approved these changes

Verified (delta over #3047): stencil_faces is a faithful extraction of the inline decode (same control/stencil shifts, back=front when back-face stencil is off). The enumeration bounds at faces(≤2) × writes(≤3) × tail(4) = 24 candidates and covers exactly the non-kept fields the doc names: b14/b15, register-decoded faces under stencil-off, and write-mask alternatives under kept-0. The test discriminates each variant. 25,465 of 25,471 records named.

**@⁠kotekompotek** on GitHub · 2026-11-26 05:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/3048#pullrequestreview-6068980027) · **approved these changes** Verified (delta over #3047): `stencil_faces` is a faithful extraction of the inline decode (same control/stencil shifts, back=front when back-face stencil is off). The enumeration bounds at faces(≤2) × writes(≤3) × tail(4) = 24 candidates and covers exactly the non-kept fields the doc names: b14/b15, register-decoded faces under stencil-off, and write-mask alternatives under kept-0. The test discriminates each variant. 25,465 of 25,471 records named.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 19:22 UTC · original

Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 1d5afa0 (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 869 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: a_rasteriser_reads_from_its_registers, a_record_names_its_rasteriser_from_the_register_image, depth_states_try_what_the_registers_do_not_keep.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 19:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/3048#issuecomment-7201515030) Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `1d5afa0` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **869 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `a_rasteriser_reads_from_its_registers`, `a_record_names_its_rasteriser_from_the_register_image`, `depth_states_try_what_the_registers_do_not_keep`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3048/head:github-bot/gh-3048'
git switch 'github-bot/gh-3048'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3048'
git switch 'github-bot/gh-3048'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3048'
git switch 'github-bot/gh-3048'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3048'
git switch 'main'
git merge --squash 'github-bot/gh-3048'
git switch 'main'
git merge --ff-only 'github-bot/gh-3048'
git switch 'main'
git merge 'github-bot/gh-3048'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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!3048
No description provided.