Repository navigation
Conversation
BeginQuery, EndQuery and ResolveQueryData now record into the host list: a console query heap gets a host heap on first use, of the matching type (occlusion kinds share one, timestamps their own, pipeline statistics theirs). Resolutions land in a read-back buffer the list maps once it has run and copies into title memory. Timestamps are the host GPU's clock, so they are rescaled to the title's TICKS (100 MHz) on the way out; the queue's frequency comes from GetTimestampFrequency. D3D12 has no BeginQuery for timestamps, so begin_query skips them and only EndQuery marks them, as the API requires. A heap whose kind or device cannot give a host heap keeps the previous plausible answers, marked as a shortcut.
The copy-back multiplied in u64, so a tick count times 100 MHz saturated to u64::MAX before the division and every guest timestamp came out identical: a 1 GHz host passes u64::MAX / 100_000_000 with a 26.5 ms interval, and a 10 MHz host with 0.25 s. The product is now taken in u128; both of the reviewed intervals scale correctly, which the test pins. Rebased onto main 63bcca4 to resolve the conflict in host.rs (both sides add a Deferred field, so both are kept), and the README row no longer lists real queries as missing.
|
I ran a guest timestamp heap through
With that correction, the new timestamp scaling on this PR agrees with the native readback. Two runs per adapter gave exact timestamps and preserved both guard words. One interval per adapter is shown below. Guest deltas are in the title’s 100 MHz clock.
For comparison, with the same heap correction on parent git fetch https://github.com/steven-seagull27/VIctory.git codex/pr3138-query-heap-kind
git cherry-pick 4a47605a66f47dec0d9cdd9074e26f5a5a853108
$env:VICTORY_D3D12_DEBUG = '1'
$env:VICTORY_D3D12_WARP = '0'
cargo test --locked -p victory-gpu --features diagnostics --lib query::timestamp_readback::timestamp_heap_resolves_the_same_slots_as_native_d3d12 -- --exact --ignored --nocaptureSet I also checked the other affected mapping using empty query intervals. The unmodified head refused a pipeline-statistics heap (kind 2, operation 3) on both adapters with the same debug-layer error. With the patch, all 88 bytes of the guest statistics matched the native result on each device, and both neighboring guards stayed intact. Ordinary and binary occlusion queries (heap 0, operations 0 and 1) matched the native results before and after the patch on both adapters. AI-assisted implementation and verification using synthetic queries. |
Dukestar69
left a comment
There was a problem hiding this comment.
Verified on RTX 5090 & WARP against origin/main (63bcca4):
cargo test -p victory-gpu --lib query:: -- --test-threads=1: 3/3 passed on RTX 5090 and WARP.cargo test -p victory-gpu --lib list:: -- --test-threads=1: 4/4 passed;queue::: passed.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.
Cleanly executes timestamp/occlusion queries on the host GPU and resolves them back to title memory.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
…y are (pull request Marvisak#927), SDWA sign extension of 16-bit results (upstream VIctory Marvisak#3124); two switches off by default (clamp windows, occlusion queries) and offline tools - Marvisak#927 (tippythetaidum): a buffer_load_format whose every use takes a half as f16, and d16 typed loads and stores at a table's fixed places, move 16-bit integers bit-exactly through unsigned twin views (HostShader::half_views). The face network reads its indices this way: mouths open and move (confirmed in a test run on an RTX 4070). Thank you, tippythetaidum. - upstream Marvisak#3124: SDWA dst_unused 1 (sext) with WORD_0 copies bit 15 upward; the reserved dst_unused 3 is refused. - VICTORY_CLAMP_WINDOW=1|alt (after upstream Marvisak#3197): indirect draws clamped a window at a time. Measured on this layer: 1.0 draw a pass (nothing joins): stays off. - VICTORY_OCCLUSION=1|alt (after upstream Marvisak#3138): the title's occlusion queries answered by the card; a counter of queries by kind (the title begins thousands). Not yet measured: off. - translate: VICTORY_NATIVE_HEADS lists each container program's first bytes; an ignored test decodes a raw GFX10 code file; the native pipeline dump writes root signatures. (Device methods 0x1c8 / 0x218 turned out to be a precompiled-pipeline cache the title falls back from.) The shader translator changed: delete both shader caches before the first run.
Replaces #2354, which no longer merges (conflict in
crates/victory-gpu/src/host.rs) and had the timestamp overflow from its review. Rebased ontomain63bcca4.Rebase. Both sides added a field to
Deferred(waitsfrom main,resolveshere), so both are kept.Timestamp fix (the review's finding).
crates/victory-gpu/src/host.rsscaled withat.saturating_mul(TIMESTAMP_FREQUENCY) / host, and both reviewed tick counts overflow u64 before the division, so every guest timestamp came out identical. Scaling now goes throughtitle_ticks(at, host_hz)in u128:timestamps_scale_to_the_title_clockpins both intervals from the review: 26,509,312 ticks on a 1 GHz host → 2,650,931, and 254,637 on a 10 MHz host → 2,546,370, plus a zero frequency.The README row no longer lists real queries as missing.