Repository navigation
Game: recover depth-bounds-enabled states in pipeline prebuild - #3040
fuzeofficlal wants to merge 1 commit into
Conversation
`pipelines::depth_stencil_desc` already serializes compact depth-stencil byte 15 into `D3D12_DEPTH_STENCIL_DESC1.DepthBoundsTestEnable` (used by `victory-gpu` after Marvisak#158), but both `depth_from_registers` and the stencil-off fallback enumeration in `depth_space` always left byte 15 at zero. Decode `DB_DEPTH_CONTROL` bit 3 (`DEPTH_BOUNDS_ENABLE`) in `depth_from_registers` (and try both `0` and `1` when the hardware depth test bit is off, matching the existing depth-enable/write/func recovery), and include `b[15] in [0, 1]` in the stencil-off `depth_space` fallback.
|
Note for maintainers: #3048 (stacked on #3047) also addresses |
kotekompotek
left a comment
There was a problem hiding this comment.
Verified: control >> 3 & 1 is 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_registers on different bases — the second to merge will conflict; whichever direction the stack takes, the other needs rebasing.
Dukestar69
left a comment
There was a problem hiding this comment.
Tested locally merged onto origin/main (63bcca4) on Windows 11 x64:
- Diff review: Adding depth-bounds (
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).
|
Automated triage for the maintainers. The gap is real. In
The tests use synthetic registers and a synthetic pack only, with no title data, which is fine. Generated by Claude Code |
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)