GPU: occlusion queries and timestamps run on the host (FIND-8) #1740
No reviewers
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!1740
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1740/head"
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?
@JurajSimicevic on GitHub · 2026-11-24 21:41 UTC · original
JurajSimicevic:gpu/real-queries→main· +604 −23 · 5 files · 2 commits · closed without mergingCloses 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
70564ae) into gpu/real-queries 075e963a73@upipibi on GitHub · 2026-11-24 22:21 UTC · original
Overlap for the reviewers: #1731 (opened 11 minutes earlier, rebased onto
70564ae, reviewed by kais7654) also gives occlusion queries a hostID3D12QueryHeap. ItsBeginQuery/EndQueryrun on the host list, and the results are read back into title memory after the submission waits. The difference: this PR also does timestamps (queue.rs,draw.rs) and is larger inquery.rs(+391 against +74). Both edithost.rs,list.rsandquery.rs, so only one of the occlusion paths can merge as is. From reading the file lists and descriptions; nothing built.AI-assisted (Claude Code).
@JurajSimicevic on GitHub · 2026-11-24 22:42 UTC · original
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:
GetClockCalibration; #1731 keeps the process clock.Both edit the same functions, so only one can merge as is; happy to take anything from #1731 that this one lacks.
AI-assisted.
@JurajSimicevic on GitHub · 2026-11-24 22:58 UTC · original
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
mainnow.What this one adds over #159, if useful for whichever goes in: it is on today's
main(70564ae), a query whose span had a draw or dispatch dropped on the host still reports visible (so missing shaders can't make the title cull geometry), and it was checked in the game on an RTX 5080. Happy to close this in favour of #159, or to fold the dropped-work part into it.AI-assisted.
@JurajSimicevic on GitHub · 2026-11-25 00:34 UTC · original
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
mainand an in-game check.@r4tedx, once #159 is rebased onto current
main, I can run it in the game on an RTX 5080 (diag build, debug layer and DRED) and report there.AI-assisted.
Pull request closed