Repository navigation
GPU: occlusion queries and timestamps run on the host (FIND-8) - #1740
JurajSimicevic wants to merge 2 commits into
Conversation
Occlusion and timestamp heaps get a host query heap. BeginQuery and EndQuery run on the host list, and ResolveQueryData resolves into a read-back buffer whose results the bottom-of-pipe writes copy into the title's buffer once the list has run. A query whose span saw a draw or dispatch dropped on the host, or that was left open at list close, still reports visible, so missing shaders never make the title cull geometry. Host timestamps are put on the title's 100 MHz clock through the queue's clock calibration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps the new drop reporting and twin-state clearing from main beside the query changes; the BeginQuery/EndQuery slots move into main's larger method table. Query tests drain earlier debug-layer messages first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (70564ae, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):
cargo test -p victory-gpu— all 79 passing tests (including all 3 new query/timestamp tests) pass on both RTX 5090 hardware andVICTORY_D3D12_WARP=1(0 new failures; the 2HEAP_VIEWSfailures reproduce identically on untouchedorigin/main70564ae)cargo clippy -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok
Clean host occlusion query and calibrated timestamp implementation with solid test coverage. Looks good.
AI-assisted (Gemini 4 Neon).
|
Overlap for the reviewers: #1731 (opened 11 minutes earlier, rebased onto AI-assisted (Claude Code). |
|
For the reviewers, on the overlap with #1731 noted above: FIND-8 was claimed for this PR in #1633 at 21:24 (#1731's claim followed at 21:31), and the two differ in a few ways that matter for choosing one:
Both edit the same functions, so only one can merge as is; happy to take anything from #1731 that this one lacks. AI-assisted. |
|
A correction to my comparison above: this PR also overlaps #159 by r4tedx, opened this morning (01:01), which I missed. #159 already runs occlusion, pipeline statistics and timestamp queries on the host, puts timestamps on the title's clock through the queue's clock calibration, and ends queries left open at close. It came first and covers more (statistics too); it conflicts with What this one adds over #159, if useful for whichever goes in: it is on today's AI-assisted. |
|
Closing in favour of #159, which came first (01:01) and covers everything here and more (pipeline statistics too). A correction to my comment above: I wrote that this PR adds a guard for queries around dropped draws over #159. That's wrong: #159's second commit ("an occlusion query around a draw the host skipped keeps its stand-in") already does it. The only differences were being on a newer @r4tedx, once #159 is rebased onto current AI-assisted. |
Closes FIND-8 in #1633 (from #1317, H-8.1/H-8.2).
What
Until now every query was answered with a plausible value: occlusion said a million samples passed, binary occlusion said visible, and timestamps were CPU time taken after the submission's wait. The title's own occlusion culling and its GPU timing could not work.
query.rs: an occlusion or timestamp heap now has a hostID3D12QueryHeapbehind it.BeginQuery/EndQuery(separate methods now, slots 28 and 29) run on the host list.ResolveQueryDataresolves into a per-list read-back buffer, and the bottom-of-pipe writes copy the results into the title's buffer once the list has run, as the other deferred writes already do.GetClockCalibrationto the CPU's performance counter, then to the 100 MHz clockWritten::GpuTimestampalready reports, so resolved timestamps and bottom-of-pipe timestamps can be compared.HostList::keep) until it is reset, since the title may release a heap before the list runs.Tests
Three new GPU tests in
query::tests(they skip without a host GPU):Written::GpuTimestampread right after.They also pass with
--features diagnosticsandVICTORY_D3D12_DEBUG=1(a deliberately invalid query call ends the same test with a debug-layer stop, so the layer is active there).cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsandcargo test --workspace --lockedpass.In the game
RTX 5080 (driver 32.0.16.1742), Windows 11 26200, diag build with the debug layer and DRED, on
mainwith only this change. Menus and loading stay at 30 fps. The title resolves occlusion queries on the host as soon as it is in the world (queries resolved on the host kind=0). The debug layer reports nothing about queries or read-back buffers; its only errors are the known title-buffer state mismatch (#548, fixed by #1691). The run ends in the known NVIDIA world hang (#71), as it does without this change.Not measured yet: how much overdraw this saves, since the world still hangs on NVIDIA before it renders fully. With more of the world rendering, the title's culling should start to show.
AI-assisted (Claude Code).
🤖 Generated with Claude Code