Skip to content

GPU: the depth bounds test reaches the host - #158

Merged
Marvisak merged 4 commits into
Marvisak:mainfrom
r4tedx:gpu/depth-bounds
Nov 25, 2026
Merged

Marvisak merged 4 commits into
Marvisak:mainfrom
r4tedx:gpu/depth-bounds

Conversation

@r4tedx

@r4tedx r4tedx commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Rebased onto main 940d32f (2026-11-25); head b5c468f drops the mesh-dispatch test that started dxc, per the triage. main still drops the flag and ignores the slot, so the change is the same; what moved with the rebase is under "Now" and "Tested".

What

The README lists depth bounds as missing for the world. Two places dropped it:

  • the pipeline stream reader narrowed subobject 21 (D3D12_DEPTH_STENCIL_DESC1) to the plain description and discarded DepthBoundsTestEnable;
  • the list's 0x220 slot (OMSetDepthBounds) was ignored_state.

Now:

  • The flag is kept in the graphics state and in the pipeline cache name. Vertex and mesh pipelines that ask for the test are made from a stream with DEPTH_STENCIL1 (the mesh stream helper is generalised for both); others are made as before. Since the rebase the vertex stream also carries the rectangle lists' geometry shader (683ad7a), and both streams the topology type main gives the mesh stream.
  • OMSetDepthBounds(min, max) reaches the host list (slot 0x220, 0x230 on newer lists through the existing slot shift) and is replayed when a graphics pipeline is bound, including after the indirect argument clamp. Fresh and reset lists keep D3D12's 0..1.
  • Hosts without DepthBoundsTestSupported keep today's behaviour and warn once.

Not verified

No game files were used. The entry point assumes the PC two-f32 signature and needs checking against a title. The kind-21 subobject is read with the PC layout; main's pre-build (depth_stencil_desc in crates/victory-game/src/pipelines.rs) writes the engine's description with the depth-bounds flag at the same offset, which I read but did not check against a title.

Not run since the rebase: the mesh stream with DEPTH_STENCIL1 (its GPU test, which started dxc, was removed at b5c468f; the stream-level test still covers the flag), a rectangle-list pipeline with depth bounds (the geometry-shader subobject was empty in the run), the pipeline library's load path for either stream, and anything on a hardware GPU.

Tested

At 49dd080, synthetic only:

  • CI on this head is green (clippy, clippy with all features, cargo test --workspace --locked on the runner's WARP adapter).
  • Here on WARP (VICTORY_D3D12_WARP=1, --features diagnostics, --test-threads=1): cargo test -p victory-gpu 149 passed, 0 failed, 2 ignored. The draw test reported depth bounds supported and read back [0.25, 0.5, 0.25, 0.25] for fresh, excluded, included and reset: with bounds excluding the cleared depth the pixel keeps 0.5; with bounds including it, 0.25 is written. The mesh-dispatch test was skipped (VICTORY_PC_DXC unset); it has since been removed (b5c468f), so no code in this PR starts a process.
  • Both clippy commands are clean with -D warnings. cargo test -p xtask: 6 passed (policy included).

Before the rebase (head 520d629, old main), on an NVIDIA RTX 5070 and WARP: the same draw and the mesh dispatch behaved as above, with support forced off every pixel was drawn, and the stream-reader test failed on main (flag dropped). Testers ran that head on an RTX 5060 Laptop, an RTX 3070 Ti and an RTX 5090 (comments below).

Touches list.rs/draw.rs near #24 and host.rs near #32; neither implements depth bounds.

#301 (open) keeps the kind-26 depth-stencil description in the same GraphicsState and leaves depth bounds to this PR; merged together the build fails until depth_bounds is carried through kind 26, so whichever lands second needs that (noted by its author on #301).

AI-assisted; no game assets were used.

🤖 Generated with Claude Code

AntoninMichelq pushed a commit to AntoninMichelq/VIctory-forkAMD that referenced this pull request Nov 24, 2026
…nto the integration

The depth-bounds feature query moves into Host::from_device (PR Marvisak#230) so
the WARP test hosts query it too. The PR's test calls execute with
&HostList (the branch's list reuse made new_list return Arc).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremygold02

Copy link
Copy Markdown
Contributor

Tested head 728a8e3c91e7a8417c36ac9863d15bfb1e2eb11a with cargo test -p victory-gpu --lib depth_bounds_test -- --test-threads=1: 3 passed, 0 failed (44 unrelated tests filtered out). The cases verify depth bounds reach host handling for a title draw and mesh dispatch, and that the depth-bounds flag changes stream state (depth_bounds_test.rs). This is unit coverage; no live GPU or title run was performed.

@ghost ghost mentioned this pull request Nov 24, 2026
@DeerSilver

Copy link
Copy Markdown

Tested head 520d629 merged onto main ffe310e (clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only: pass.

  • The three new tests pass:
    • depth_bounds_flag_changes_the_stream_state
    • depth_bounds_control_a_title_draw
    • depth_bounds_control_a_title_mesh_dispatch
  • Both render tests ran on the RTX 5060 (DXGI adapter 0 on this laptop). In the default run the mesh one skips with VICTORY_PC_DXC is unset. I re-ran it with VICTORY_PC_DXC set to the Windows SDK's 10.0.26100.0\x64\dxc.exe, and it then ran on the GPU with no skip message. So depth bounds control both a draw and a mesh dispatch on NVIDIA.
  • cargo test --workspace --locked: 345 passed, 0 failed, 6 ignored, against 342 / 6 on main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: clean.

AI-assisted (Claude Code).

Xeltax pushed a commit to Xeltax/VIcky that referenced this pull request Nov 24, 2026
Conflicts:
- crates/victory-gpu/src/pipeline/host.rs: Marvisak#352 (gpu-draw) added a
  triangle topology subobject to mesh_pipeline's stream and renamed the
  library key "mesh triangles"; Marvisak#158 generalised that function into
  stream_pipeline, shared by mesh pipelines and vertex pipelines with
  depth bounds. The topology now sits in a MeshStages stage struct (with
  Marvisak#352's explanation), not in the shared stream, as VertexStream carries
  its own topology and a stream may name one only once. Marvisak#352's cache key
  and Marvisak#158's depth-stencil choice are both kept; Marvisak#352's library test
  calls a test-only mesh_pipeline() over stream_pipeline.
- README.md: Marvisak#158's GPU: world row (depth bounds) with the Shaders row
  from shader-opcodes (64-bit image atomics no longer listed as missing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@465d6a0eac

465d6a0eac commented Nov 24, 2026 •

Copy link
Copy Markdown

Thank you for this, @r4tedx! Many pull requests here are still waiting to be merged, so I've ported this one to 465d6a0eac/AgentRecompVI, a VIctory fork where AI agents review and merge each other's work: https://github.com/465d6a0eac/AgentRecompVI/pull/27. You're credited as the author there. This pull request stays the original.

Test results

  • Windows 11, NVIDIA GeForce RTX 3070 Ti (driver 32.0.16.1088, 32-lane waves): cargo clippy (both variants) and cargo test --workspace pass (345 passed, 0 failed).
  • depth_bounds_control_a_title_draw passes on the GPU and reports depth bounds on NVIDIA GeForce RTX 3070 Ti: true; depth_bounds_control_a_title_mesh_dispatch was skipped here (no VICTORY_PC_DXC).
  • With it in, the title boots and runs its menus at 30 fps on that machine, through the intro video, first-boot settings and legal screens up to the terms screen. I haven't reached the world yet.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. This is a recommendation to look, not an approval. It merges cleanly into main. CI: check passing.

The PR forwards the title's depth bounds to the host. Slot 68 (0x220, already labelled as depth bounds in list.rs) now calls State::set_depth_bounds, which uses OMSetDepthBounds, and the bounds are set again whenever a graphics pipeline is bound. GraphicsState keeps DepthBoundsTestEnable from subobject kind 21, which main drops with a shortcut comment. The flag is part of the pipeline key, and hosts that report DepthBoundsTestSupported build the pipeline from a stream with DEPTH_STENCIL1, for both mesh and vertex pipelines through the shared stream_pipeline.

What I checked: kind 11 clears the flag, State::reset returns the bounds to none, vertex pipelines with bounds still go through library::pipeline under a distinct name, and nothing in the PR starts a process now that the dxc test is gone. As the thread notes, the title does not enable the test on the window/fence pipeline from the RTX 3070 report, so that visual change probably came from another PR on that branch. The PR stands on its own as a missing capability.


Generated by Claude Code

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested PR head directly on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu --lib depth_bounds — 3 passed, 0 failed on both RTX 5090 hardware and VICTORY_D3D12_WARP=1
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok
  • Merge status: Currently CONFLICTING with origin/main (940d32f). Once rebased onto main, happy to re-verify and approve!

AI-assisted (Gemini 4 Neon).

Keep the kind-21 enable flag in the graphics state and pipeline cache
key. Use DEPTH_STENCIL1 for vertex and mesh streams that request the
test when the host supports it. Unsupported hosts fall back to the
plain depth-stencil state and warn once.

Forward the title's depth bounds to the host command list and replay
them when binding a graphics pipeline, including after the indirect
clamp. New and reset lists start with D3D12's 0..1 default.

Synthetic title draws and mesh dispatches on an RTX 5070 and WARP
kept excluded pixels at the cleared depth of 0.5 and wrote 0.25 to
included pixels. Fresh and reset lists also wrote 0.25. A forced
unsupported run drew all pixels, and the stream reader regression
failed with the upstream reader. Since the rebase onto 940d32f the
vertex stream also carries the rectangle lists' geometry shader and
both streams the topology type; only the draw ran again, on WARP.
The console subobject layout and call signature still need title-side
verification.
@r4tedx

r4tedx commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 940d32f: head 49dd080, one commit, CI green. @DenRakEiw thanks for the run on the RTX 5090 and WARP, and for offering to re-verify; this is the head to check.

main still has no depth bounds of its own (kind 21 drops the flag, slot 0x220 is ignored_state), so the change is the same. Two things moved with the rebase, both in pipeline/host.rs:

  • the vertex stream used for a depth-bounds pipeline now carries the rectangle lists' geometry shader that main added (683ad7a), so such a pipeline keeps it;
  • vertex and mesh streams share the one topology subobject main added to the mesh stream.

Tested at 49dd080 on WARP only (VICTORY_D3D12_WARP=1, diagnostics build, one test thread): cargo test -p victory-gpu 149 passed, 0 failed, 2 ignored; the draw test read back [0.25, 0.5, 0.25, 0.25]. Not run since the rebase: the mesh-dispatch test (needs VICTORY_PC_DXC), a rectangle-list pipeline with depth bounds, and anything on a hardware GPU. A hardware run with VICTORY_PC_DXC set would cover the first and the last. The description has the details.

No game data was used. AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	crates/victory-gpu/src/host.rs
@Slay326

Slay326 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Hardware test: this fixes a visible error on an RTX 3070. RTX 3070 (8 GB, 32-lane waves), Windows 11, Series X mode, 480 s runs into the world of Grand Theft Auto VI 1.0.2.1. Local test branch: main 940d32f plus #1906, #1890, #1883, #1962, #1779, #1763, #1762, a page-mark guard like #2167 and the memory PRs #2129, #2180, #1873, #1969, #2161.

Before: in the first cell scene (the player at the barred window), the back of the character's head was black inside a rectangle. A target dump showed the alpha prepass of the window/fence (mesh 0c6c5a3a, pixel 629743ca) writing a full rectangle into the main depth target, over the nearer head; the hair was black exactly inside that rectangle.

With this PR (merged on the branch above; one conflict in host.rs, both sides kept, plus the heap_usage field from #1962 in the test's state): the head and ponytail show in full in the same scene. 640 s run, no device removal. victory-gpu: both depth-bounds tests pass.

AI-assisted.

@Venom2054

Copy link
Copy Markdown

Title-side depth-bounds data for b5c468f on native Windows 11, RTX 5070 Ti (621.01). I compared the same 940d32f-based prologue build (including #2311 and #2349), save, scripted input and starting cache, with and without this PR. The PR run had two logging probes, one at set_depth_bounds and one at graphics pipeline creation. Both runs reached the cell window and completed a 330 s observation without device removal.

  • The title called set_depth_bounds with (0.0, 1.0) first. After world entry the first non-default pair was approximately (0.000047207, 0.000277936). These are the values received as two f32s by this build.
  • The host reported depth bounds supported. I saw an enabled request for a vertex pipeline. For the window/fence mesh and pixel pair identified in the RTX 3070 report (0c6c5a3a / 629743ca), the one pipeline creation I observed had DepthBoundsTestEnable = false. The head remained a dark silhouette in both runs, so I couldn't isolate the reported rectangular occlusion on this integration. That flag would be worth comparing on the build that showed the change.
  • Both PR tests passed on the RTX. The draw test read back [0.25, 0.5, 0.25, 0.25] (fresh, excluded, included, reset).

As a separate visual control I tried only the rectangle shader from #2366 (d29e14f) on the same baseline. In three captures of the settled courtyard, the same upper edge had three sawtooth jumps of at least 24 px on the baseline and with #158 alone, and zero with #2366 alone. The result held at three brightness thresholds. This separates the triangles around the opening from the dark silhouette on this setup.

Tested with OpenAI Codex assistance.

@r4tedx

r4tedx commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@Venom2054 thank you, especially for the two probes. The DepthBoundsTestEnable = false you saw on the window/fence pair is the comparison to make next.

Our own runs on an RTX 5070 can't answer that yet. Our layer builds carry an older head of this PR (49dd080), and the same window/fence pipeline is created in every run, but no build of ours logs the depth-bounds flag per pipeline. A coming build adds that field to the pipeline line. When it has run, I'll post the enable flag and the bounds pair for that pipeline here, so it can be set next to your 5070 Ti numbers and Slay326's 3070 result.

The runs mentioned here were runs of the title on my PC with my own local copy of its data; only logged flags and values will be quoted.

AI-assisted

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@r4tedx

r4tedx commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Updated for the current main: head 1a45c5e3, two merge commits on b5c468f (main 67e8ae1, then 13f91ca), no force-push.

  • The host.rs conflict was main's new code next to the depth-bounds lines; both are kept. git diff 13f91ca 1a45c5e3 is the PR's own 7-file change. The only difference from before is that the README "GPU: world" row now starts from main's new wording.
  • victory-gpu library tests with --features diagnostics on WARP, at the first merge: 200 passed, 0 failed, 1 ignored (a release-only benchmark). Both depth-bounds tests pass. After the README-only second merge, cargo check -p victory-gpu --all-targets --features diagnostics is clean.

@Slay326 thank you for the RTX 3070 result: the head and ponytail coming back in that scene is the first in-title confirmation of this PR.

Synthetic tests only for this update; no title data used.

AI-assisted

@TaynanGT TaynanGT mentioned this pull request Nov 25, 2026
@r4tedx

r4tedx commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@Venom2054 here is the comparison promised above. It agrees with your result.

Our run: RTX 5070, diagnostics build of a local play tree that carries an older head of this PR (49dd080) plus one logging commit that prints the depth-bounds state per pipeline.

  • The window/fence pipeline (the mesh and pixel pair named in the RTX 3070 report) is created with depth_bounds_test = false. The title does not ask for the test on it, so nothing is applied.
  • Bounds set on the lists: first (0.0, 1.0), then (4.8637e-5, 2.7794e-4), then (2.0462e-4, 2.7794e-4). Your max is the same, and your min of 4.72e-5 is close.

So on this pipeline this PR has nothing to switch on: the bounds reach the host, but the title draws the window/fence without the test. That also means the depth-bounds test on this pipeline isn't what changed the picture in Slay326's RTX 3070 run. Their branch differs from main in several other PRs, and I haven't found which change made the difference there.

This was a run of the title on my PC with my own local copy of its data. Only the logged flags and values are quoted here.

AI-assisted

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

I reran the ClearState integration regression on this PR at 1a45c5e, combined with the current-main ClearState follow-up based on #1166 at 2d779bf. WARP reported depth-bounds support. The same guest draw fixture read these five depth values before and after the integration fix.

Test build Fresh Excluded Included ClearState Reset
Composition 3d808f8 0.25 0.5 0.25 0.5 0.25
With bfa77cb 0.25 0.5 0.25 0.25 0.25

The next bind replayed the saved depth bounds after ClearState. bfa77cb clears the saved range while retaining #1166's cached views and descriptor ownership. It keeps swarm's Git authorship from the original regression and both PR histories. Six paired WARP runs reproduced the readback. The serial GPU suite passed 203 tests with one ignored under each debug setting. Strict Clippy in both configurations and asset policy passed.

Please retain the Git authorship and existing trailer if reapplying the integration commit. If you fold the adaptation into another commit, please keep its attribution with the following trailer.

Co-authored-by: andrewpozdnakov7-jpg andrewpozdnakov7-jpg@users.noreply.github.com

AI-assisted with Codex. Synthetic GPU commands on WARP.

@r4tedx

r4tedx commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

@andrewpozdnakov7-jpg thank you. The ClearState row shows a real gap in the combination: the saved range survives ClearState and is replayed on the next bind.

bfa77cb adds self.depth_bounds = None; to #1166's State::clear_state. Current main (13f91ca) has no ClearState yet, and nothing in this PR's draw.rs resets state there. So the change can't land on this PR alone: it needs whichever of #158 and #1166 merges second.

I read the diff only and haven't run it. The table and the 203-test WARP suite are your results. No title data was involved.

AI-assisted

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
@Marvisak
Marvisak merged commit 842b0cb into Marvisak:main Nov 25, 2026
1 check passed
wkdwilliams added a commit to wkdwilliams/VIctory that referenced this pull request Nov 25, 2026
Main moved on (the depth bounds test, Marvisak#158): keep the device made on the chosen runtime and
add main's depth bounds support query after it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
alexandruiulian201-bot pushed a commit to alexandruiulian201-bot/VIctory that referenced this pull request Nov 25, 2026
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
host.rs: main's Send/Sync impls for HostList and Marvisak#158's
warn_depth_bounds both kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
Upstream main merged Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906 and Marvisak#1152 and took up what
Marvisak#1769 (LDS bounds, Marvisak#1949) and Marvisak#1763 (typed UAV formats, Marvisak#2462) did; main's
code is kept for those.
- emit/lower.rs: ds_bpermute within each half (main's Marvisak#573, same as
  Marvisak#439's); LDS bounds as main's Marvisak#1949 (Marvisak#1769's test-only counter kept, its
  and_guard dropped); title-memory marks: main's straddling-write lookup
  (Marvisak#2484) with Marvisak#2167's current head (3cb308d, rebased on 63bcca4): guarded
  dirty atomics, raw_dword2, memory_null, synthetic_mark_dxil in
  lower/mark_tests.rs; the old Marvisak#2167 head taken out first.
- emit/host.rs: main's shared WARP device and lock (Marvisak#244) with Marvisak#439's
  adapter list and Host::on (create_device takes an optional adapter).
- descriptor/host.rs: main's Marvisak#2462 format checks; Marvisak#1763's tests kept.
- gpu host.rs: main's multi-plane present with Marvisak#2310's crumbed copy.
- pipeline.rs: Marvisak#2118/Marvisak#2311's builder and BVH checks with main's skip
  hashes (Marvisak#1320); draw.rs, shadow.rs, main.rs: both sides.
- Tests main added since get Marvisak#439's Parts fields and emit's Target.
- README: base 63bcca4; rows of PRs merged upstream, superseded or closed
  taken out, with a note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
desplmfao added a commit to desplmfao/VIctory that referenced this pull request Nov 26, 2026
The previous renderer (old upstream base 940d32f) is the first parent and
is also kept as the branch renderer-2026-11-25-oldbase; the second parent
is the rebuild: fork main (upstream main 63bcca4 + our pull requests) with
the renderer stack merged on it: Marvisak#439 (on main: update/439-main's
resolution), Marvisak#2309, Marvisak#2167, Marvisak#2118, Marvisak#2311, Marvisak#1722, Marvisak#1751, Marvisak#688, Marvisak#1872, Marvisak#2292,
Marvisak#2310, Marvisak#2112 (opt-in), Marvisak#2230 (latch on by default), Marvisak#2389, Marvisak#2088 (small
windows opt-in), Marvisak#2099's new head, and tonight's Marvisak#491 journal fixes.
Merged upstream since: Marvisak#2143, Marvisak#2162, Marvisak#158, Marvisak#1906, Marvisak#1152; superseded by
main: Marvisak#1769, Marvisak#1763, Marvisak#2366.

The picture on this base still shows the overlay that plain upstream main
shows too; that is being looked into.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants