Repository navigation
GPU: host descriptor heaps, depth twin copies, frame timing - #2547
Therecalloftheonion wants to merge 8 commits into
Conversation
The host asked for 2^21 view descriptors, above D3D12's 1,000,000 limit, so every heap fell back to 65,536 slots: the shader clamp and the null buffer views pointed past the heap, and the dynamic slots for per-draw tables ran out (Marvisak#59). Make the heap the size the clamp uses (262,144 slots for now), keep the title slots, split the rest into dynamic slots and dedicated pairs for host copies, and create the null views inside the heap. Fall back to the smaller heap only if the host refuses the size. The stride and mark tables follow the same constant, and host copies' view pairs no longer consume dynamic slots.
A depth twin copied every subresource through a scratch buffer, so a D32 twin needed a full extra texture or two. Subresources of one format family now copy straight between the depth texture and the twin; the scratch is made only for converted 16-bit planes and only when one is needed. D32 twins now exist at all: the previous exact-format check rejected them, so shader writes to D32 depth were dropped. Add a hardware test that copies a D32 depth texture into its twin, reads it back, and checks every texel and the device state.
Create the waitable timer with TIMER_ALL_ACCESS: WaitForSingleObject needs SYNCHRONIZE, and with TIMER_MODIFY_STATE alone every wait failed and fell back to the 15.6 ms system sleep. Check for NULL rather than INVALID_HANDLE_VALUE, and keep one timer per thread so two frame threads cannot reset each other's due time.
The test slept 2 ms and raced the 8 ms window in which a copy re-reads a page list the title has not filled yet; under load the fill could arrive after the window. Have the copy report when it found the list empty, then fill it, so the retry path is covered deterministically.
The translator and frame path run for as long as the title does. Let the optimizer see across the emulated runtime and the GPU crates in release builds; development and diagnostics profiles are unchanged.
Test and crash logs are not part of the repository or the asset policy allowlist; ignore them so a log left in the working tree does not trip the policy test.
Resolve the twin tests: keep both the direct-copy test and upstream's prelude-state test.
The host root signature always declares one 32-bit constant (Num32BitValues.max(1)), but four memory tests sized their user data from user_data_dwords() and could pass a count of 0 to SetComputeRoot32BitConstants. On the RX 6700 XT the driver access-violates on that call (WARP tolerates it), killing the shader test process; the other shader tests already use max(1). Memory tests now do the same.
|
Automated triage for the maintainers. This PR bundles eight unrelated changes. They need to be split, and the headline one is not right as it stands.
CI is passing. Generated by Claude Code |
|
Measured
Result: no measurable difference. The two methods differ by under 0.1 ms in the mean and the order flips between runs. Plain Written with AI help (Claude/Kiro); the numbers are from runs on my machine. |
|
Thanks for the triage. Split and withdrawn as requested.
The three reviewable pieces are now separate:
Closing this one. Thanks. |
…it declares (Marvisak#2571) The test harness declares every program's root constants with `user_data_dwords().max(1)` values, but `dispatch` passed a test's `Root::Constants(vec![])` as 0 values through the empty Vec's dangling pointer. WARP ignores that; a hardware driver reads through it, and the test process ends with 0xC0000005 (heap_direct_texture_reads_mark_their_heap_index on an RTX 5070 and an RTX 4070, and on AMD per Marvisak#2547), which also stops every later victory-shader test in that run. An empty list is now set as one zero, in the compute and the graphics path; `fuses_fmad` already did this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it declares (Marvisak#2571) The test harness declares every program's root constants with `user_data_dwords().max(1)` values, but `dispatch` passed a test's `Root::Constants(vec![])` as 0 values through the empty Vec's dangling pointer. WARP ignores that; a hardware driver reads through it, and the test process ends with 0xC0000005 (heap_direct_texture_reads_mark_their_heap_index on an RTX 5070 and an RTX 4070, and on AMD per Marvisak#2547), which also stops every later victory-shader test in that run. An empty list is now set as one zero, in the compute and the graphics path; `fuses_fmad` already did this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 577839a) Upstream-PR: Marvisak#2596
Summary
GPU-host fixes found while working toward the world running on a host GPU.
HEAP_VIEWSrestores more title descriptors at more memory.TIMER_MODIFY_STATEonly, soWaitForSingleObjectfailed and sub-tick waits fell back to the 15.6 ms system sleep. It also testedINVALID_HANDLE_VALUEalthough the API returns NULL, and one timer was shared by every thread. It is now per-thread withTIMER_ALL_ACCESS.*.logfiles are ignored so the asset-policy test is not tripped by a log left in the tree.Testing
cargo test -p victory-gpu --lib: 196 passed, including the new hardware copy testcargo test -p victory-shader --lib: 268 passed; two pre-existing hardware assertions on the RX 6700 XT still fail (emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride,emit::synthetic_tests::gathers_at_a_level_match_the_hardware), outside the paths changed here. The suite no longer aborts atemit::memory_tests::heap_direct_texture_reads_mark_their_heap_index; that zero-constant crash is fixed here.cargo test -p victory-hle --lib: passed repeatedlycargo clippy --workspace --all-targets --all-features --locked -- -D warnings: cleancargo xtask policy: 182 files okNo game files are included; all input remains the user's own dump.
This does not make the world playable yet. It removes descriptor/device-removal hazards, restores a depth feature that was silently dropped, and reduces avoidable GPU memory; the remaining world frame cost needs profiling on a real dump.