Game: try what depth-stencil registers do not keep (stacked on #3047) #3046
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3048"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-26T05:14:56Z.
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. Comparingdepth_from_registers's candidates with the descriptions that do match shows three things the registers don't keep:DEPTH_BOUNDS_ENABLEis clear. Both are now tried as 0 and 1.DB_STENCILREFMASKholds 0 where the description has 0xFF (or the read mask). Both are tried.STENCIL_ENABLEclear,DB_DEPTH_CONTROL/DB_STENCIL_CONTROLstill hold the faces the engine's description names. They are tried next to the D3D12 default faces.depth_from_registersnow wraps the old body (depth_kept) and adds those variants. The face decoding moved tostencil_facesso both use it. The CityHash64 still decides.Measured on
shaders.rpf1.0.2.1 (offline, RX 7900 XTX):Named::findtakes ~88 ms.translate --cache --pipelinesskips 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-game18/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
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T05:20:38Z.
Review: APPROVED
Static review of commit
1d5afa02(stacked on #3047) incrates/victory-game/src/pipelines.rs.depth_from_registerscleanly wrapsdepth_keptand tries the four combinations of(b[14], b[15]), the0xFF/ read-mask write-mask variants whenDB_STENCILREFMASKhas write mask 0 with stencil enabled, and the register-encoded stencil faces whenSTENCIL_ENABLEis clear. Trying(b[14], b[15])unconditionally also catches descriptions that enable depth bounds even whenDB_DEPTH_CONTROLbit 3 is clear, and CityHash64 remains the exact arbiter. Clean factoring viastencil_facesand clear unit tests.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T05:27:36Z.
Review: APPROVED
Verified (delta over #3047):
stencil_facesis 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.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:17:14Z.
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
1d5afa0incrates/victory-game/src/pipelines.rs.depth_from_registersnow wraps the old body (renameddepth_kept) and also tries:DB_STENCIL_CONTROL/DB_DEPTH_CONTROLstill 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_registersanddepth_spaceto 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:
checkpassing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T19:22:33Z.
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
1d5afa0(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo 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.a_rasteriser_reads_from_its_registers,a_record_names_its_rasteriser_from_the_register_image,depth_states_try_what_the_registers_do_not_keep.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#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_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-27T10:34:10Z.
I found one more case for the write-mask reconstruction. With stencil disabled, the register image can retain a non-default read mask and a zero write mask. A compact description with matching read and write masks currently goes unnamed because the extra candidates are tried only when stencil is enabled.
I put a one-commit follow-up on your exact head
1d5afa0. It reuses your existing candidates and still requires the full description to match its CityHash64. The generated regression uses read mask0x52. It fails on your head and passes with the fix. All 19 crate tests, strict Clippy, and the asset-policy check passed on Windows. Commit 79d344aTo take it on your branch:
AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T13:12:14Z.
@zed6000 I checked Steven's disabled-stencil follow-up together with #3047, #3048 and the separate blend-factor change in #3499. Tested integration at a74fe1d keeps the existing PR commits and applies Steven's 79d344a with his Git authorship.
The added regression feeds a generated graphics record through
Pack::parseandNamed::find. It requests a rasterizer with a fractional bias clamp, disabled stencil with both masks equal to 0x52, and an independently masked blend target with separate alpha factors.63bcca4recovers 0 of those 3 descriptions.1d5afa0recovers the rasterizer.I used separate Cargo target directories for the controls and the combined tree. All 22
victory-gamelibrary tests, all-target/all-feature Clippy with warnings denied, and the asset check passed. The counts are for the synthetic record.The integration test is a74fe1d. If folded into another commit, please retain Git authorship or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-28T09:14:36Z.
Thanks @steven-seagull27. Your disabled-stencil fix is now on this branch as your own commit,
79d344a, with your authorship unchanged. On an RX 7900 XTX,victory-game --libpasses (19 tests, including your regression), strict clippy passes with and without--all-features, and so does the asset-policy check.@andrewpozdnakov7-jpg, thanks for testing the combination. I left out your integration test (
a74fe1d), because its blend-target case needs #3499, which isn't part of this stack. It would make a good test for whichever of the two lands second.Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T09:19:49Z.
Agreed. The blend-target case in
a74fe1drelies on #3499. The combined coverage can go with whichever lands second. I checked the new head79d344aand its Windows CI is green.AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T12:02:07Z.
I combined the exact
79d344ahead with #3724 at97f1f0cin integration commit2073973. Both original commits are parents. Git merged the change directly intodepth_kept, where each repeated base row used to run the variant expansion again.Across 3,840 generated cases, the combined path reduced emitted rows from 1,098,240 to 1,048,080. All 835,296 first occurrences retained the same bytes and order. The default-mask and already-off back-face controls each halved their emitted rows and time, while controls with distinct rows kept the original counts. The fixture hashes each candidate, and includes the downstream variant expansion.
All 19 game tests passed, including the disabled-stencil retained-mask regression. Strict Clippy and the asset policy passed. @zed6000, the branch is available for merge coordination. Please retain the Git authors on cherry-pick or rebase.
AI-assisted with OpenAI Codex.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.