Game: recover depth-bounds-enabled states in pipeline prebuild #3038
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3040"
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 fuzeofficlal on 2026-11-26T04:57:27Z.
Problem
crates/victory-game/src/pipelines.rsdocuments compact depth-stencil byte 15 asdepth-bounds testand serializesc[15]intoD3D12_DEPTH_STENCIL_DESC1.DepthBoundsTestEnableat offset0x34(whichvictory-gpunow honors on the host after #158).However, when
Named::findrecovers depth-stencil states not present in an SGD5 database:depth_from_registersreadsDB_DEPTH_CONTROLbits0..2,4..10, and20..22but skips bit 3 (DEPTH_BOUNDS_ENABLE), leavingb[15] = 0.depth_spacealso leavesb[15] = 0.As a result, any graphics pipeline in a shader pack whose depth-stencil state enables the depth bounds test misses both register recovery and fallback enumeration, so
Named::findfails to resolve its hash and prebuild skips it asUnnamed::DepthStencil.Fix
DB_DEPTH_CONTROLbit 3 (control >> 3 & 1) into compact byte 15 indepth_from_registers. Whendepth_onis false and bit 3 is clear, try both0and1(mirroring howdepth_on == falseenumerates depth enable/write/func in case the driver clearedDB_DEPTH_CONTROLwithout a depth target).b[15]in[0, 1]for the stencil-off loop indepth_space(+128 candidates, leaving the 2.5M stencil-on enumeration unchanged).Verification
cargo test --locked -p victory-game(17 passed, including new unit tests coveringdepth_from_registers,depth_space, and end-to-endNamed::find+streamrecovery of a depth-bounds-enabled graphics record with no databases)cargo test --locked -p victory(18 passed)cargo clippy --locked -p victory-game -p victory --all-targets -- -D warningsrustfmt --edition 2024 --check crates/victory-game/src/pipelines.rscargo xtask policy(191 files ok)Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T05:28:13Z.
Review: APPROVED
Verified:
control >> 3 & 1is the console's DB_DEPTH_CONTROL depth-bounds bit; the bounds choice is conservative in the right direction — [1] when set, [0] when depth is on without it (a description claiming otherwise would be wrong), [0,1] only when depth is fully off and the registers can't keep it. The stencil-off mask re-emit is preserved per bounds value, and the end-to-end pack→name→stream test asserts DepthBoundsTestEnable lands in the pipeline stream.Maintainer note: this and #3048 implement the same depth-bounds recovery in
depth_space/depth_from_registerson different bases — the second to merge will conflict; whichever direction the stack takes, the other needs rebasing.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T05:28:51Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64:b[15]) coverage todepth_spaceand decodingDB_DEPTH_CONTROLbit 3 indepth_from_registers(emitting both0and1when depth test is off and bit 3 is cleared) cleanly recovers depth-bounds-enabled states during pipeline prebuild.cargo test -p victory-game: 17 passed, 0 failed (includingregisters_name_depth_bounds_statesandnamed_find_recovers_depth_bounds_pipeline_from_registers).cargo clippy -p victory-game --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T05:20:39Z.
Note for maintainers: #3048 (stacked on #3047) also addresses
b[15]recovery indepth_from_registersalongsideb[14]and stencil fields (tryingb[15]in0..=1even whenDB_DEPTH_CONTROLbit 3 is clear). Happy to close this in favour of #3048 if the #3047/#3048 stack is preferred, or keep this as the standaloneb[15]+depth_spacepatch.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:15:11Z.
Automated triage for the maintainers.
The gap is real. In
crates/victory-game/src/pipelines.rs,depth_from_registersanddepth_spacenever set compact byte 15 (the depth-bounds test), so a state with it set cannot be named. ReadingDB_DEPTH_CONTROLbit 3 asDEPTH_BOUNDS_ENABLEmatches the public register layout. Two things stand in the way of merging it as is:depth_from_registerstries onlyb[15] = 0. #3048 measuredshaders.rpfand reports the opposite: several descriptions set b14/b15 whileDEPTH_BOUNDS_ENABLEis clear, so it tries both values in every case. If that measurement holds, this PR still misses those states. Please give evidence for the rule (states from a shader pack it names that are otherwise unnamed), or try both values as #3048 does.depth_spaceenumeration ofb[15]. If that is worth keeping, a rebase on top of #3048 with a pack measurement showing that it names something would make this a clear, separate change.The tests use synthetic registers and a synthetic pack only, with no title data, which is fine.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T06:26:25Z.
Closing in favour of #3048 (stacked on #3047), which already covers
b[15]indepth_from_registersunconditionally with measured shader-pack results.Pull request closed