[Ready to merge] Add support for depth bounds in D3D12 translation #849
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#849
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@Xvania7 on GitHub · 2026-11-24 12:27 UTC · original
I have prepared a fix for missing depth bounds support (noted in README under "GPU: world"). Since direct PRs are restricted, the ready-to-merge branch is available in my fork: https://github.com/Xvania7/VIctory/tree/feat/issue-depth-bounds
The code includes synthetic unit tests covering depth bounds min/max translation. All checks pass locally:
cargo test -p victory-gpu: 52 passed, 0 failed, 1 ignored
cargo clippy: 0 warnings
cargo xtask policy: 154 files ok
It can be automatically merged. Maintainers can pull it or let me know if a PR is needed. (Note: AI-assisted fix)
@MichaelSmithAI on GitHub · 2026-11-24 12:53 UTC · original
There is a command-order case worth checking at
c47632f. The guest list handler saves and forwardsOMSetDepthBounds(min, max). On the next bind of a depth-bounds-enabled pipeline,State::bindreplaces that saved range withp.depth_boundsand sends the replacement to the host. The setter test checks the list immediately after the call, so it misses the overwrite at draw time.On PC the pipeline description ends with the enable flag, and the command list supplies the range. The guest stream parser reads floats at offsets 52 and 56 from the kind-21 payload. A title trace would help establish whether those bytes carry bounds on Xbox and, if so, when they take precedence over an explicit list command. Pipeline layout · Dynamic range
A focused readback would clear depth to 0.5, set list bounds to [0.7, 0.9], then draw with a bounds-enabled pipeline. Under the PC semantics the clear color should survive. #158 already replays the list's range at bind time and has draw and mesh readbacks on native hardware. This finding on #849 is from source review. PR #158
@Xvania7 on GitHub · 2026-11-24 13:00 UTC · original
Good catch, @MichaelSmithAI. You're completely right on the command-order issue.
In D3D12,
OMSetDepthBoundsis dynamic command list state, whereas the pipeline state stream only controls the enable flag (DepthBoundsTestEnable). Overwritingself.depth_boundsinsideState::bindfromp.depth_boundsclobbers whatever dynamic range the guest command list explicitly configured prior to binding the pipeline.The proper fix here is:
DepthBoundsTestEnable(inD3D12_DEPTH_STENCIL_DESC1).self.depth_boundsonStateas the authoritative dynamic command list state, mutated exclusively when the guest invokesOMSetDepthBounds.State::bind, never overwriteself.depth_boundswith static PSO values. When binding a bounds-enabled PSO, the host list should simply use the currently active dynamic range fromself.depth_bounds.Also, thanks for pointing out PR #158. Since #158 already implements this dynamic replay and includes native hardware draw/mesh readbacks, it makes total sense to consolidate efforts there instead of carrying a duplicate implementation. Appreciate the sharp code review!
@Marvisak on GitHub · 2026-11-25 06:52 UTC · original
Automated triage for the maintainers.
Depth bounds are listed as missing in the README ("GPU: world"), so this fits the project. Pull requests are open to everyone, so a branch can be offered as a pull request directly. Open pull request #158 already carries the depth bounds test, with the list's
OMSetDepthBoundsrange replayed when a pipeline is bound and hardware readbacks; the review above (the range being replaced inState::bind) applies to this branch, and the reporter agreed to consolidate there. The decision is left to the maintainers on #158.Generated by Claude Code