Repository navigation
GPU: cap a sampler heap past the host's limit, with dynamic slots for tables past it - #86
faultzonsol wants to merge 1 commit into
Conversation
A title sampler heap larger than D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE (2,048) made HostHeap::new return None, which Descriptor::host() cached for good: the heap was left out of SetDescriptorHeaps and every draw through it read no samplers. Such a heap is now capped at 2,048 slots: the title's first 1,792 and 256 dynamic ones. Tables reaching past the title slots kept are made afresh in the dynamic slots, as tables past a capped view heap already are (Marvisak#21). Dynamic slots are counted per heap, and a table larger than them is reported once instead of dropped silently. Fixes Marvisak#65 Co-authored-by: Cursor <cursoragent@cursor.com>
|
You got there first and the design is better than mine in #74: capping at Small suggestion from my branch: the cap warning logs only My branch also used |
|
Verified
Important finding in
|
|
Verified on Windows 11 with an AMD RX 7600 (driver 32.0.32029.2010), Rust 1.98.1:
This driver accepts an out-of-spec 2,049-slot sampler heap, so the up-front cap handles a case the retry-on-refusal approach missed. The tests do not exercise table remapping. Static inspection confirms the review finding: |
|
Tested
No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent). |
|
Two small things from reading this against #100 and the note from @WallasSCRIPTS, both about the constructor. 1. A title that asks for 2. The cap warning logs only What #100 has that is worth folding in here
I would rather send both as a patch on top of your branch than keep a second PR open for them. Say the word and I will post the diff here; if you would rather keep the change single-authored, that is fine too and I will close #100 - your design with the 256 dynamic sampler slots is the better one, and I said so on #100. Verified here on No game files. AI-assisted. |
|
Independent full-suite run on an AMD RDNA4 Windows machine, since #86 has no AMD run yet.
The 3 ignored are the BCPack/XMA cases that want reference data outside the repository. For comparison, main gives the same 229 / 0 / 3 here, so this PR costs nothing in the suite. No game files were used and no title was run. AI-assisted. |
…ys inside the heap) Vaximous's Marvisak#483: every descriptor-heap index the lowering computes is bounded by the bound heap's guard slot (an index at or above it reads it), which the host passes in a user-data dword of its own. Conflict resolutions: - crates/victory-gpu/src/descriptor/host.rs: this tree's sizing is kept (Marvisak#86/Marvisak#83/Marvisak#251, and 2^18 dynamic slots on a capped heap); a view heap is made one slot larger, the guard slot, after its dynamic slots and outside the pool HostHeap::dynamic hands out (`spare` does not count it). On a capped heap that is 737,855 title slots, 262,144 dynamic ones and the guard at slot 999,999. Marvisak#483 had the guard at `count + DYNAMIC` with the pool sized by a constant; here the pool is sized by `spare` (Marvisak#86), so guard_slot() is `count + spare`. - A sampler heap's guard is its last slot, dynamic ones included (`count + spare - 1`), not Marvisak#483's `count - 1`: Marvisak#86 makes sampler tables afresh in a capped sampler heap's dynamic slots, which `count - 1` would have clamped away. - crates/victory-shader/src/emit/lower.rs, Lower::new: both fields are kept (`dead`, `guard_slots`). - crates/victory-shader/src/emit/valu_tests.rs: this tree's tests and Marvisak#483's new one are both kept. Changes beyond the PR: - emit/lower.rs, fetched_index (Marvisak#307's per-lane heap index, which Marvisak#483 did not know): it goes through heap_guard too. It is an address from a lane's data, as heap_index's. - emit/image_tests.rs (Marvisak#160's harness): the user data it fills gets the guard entries (host::guard). - descriptor/host.rs: tests the_guard_slot_is_past_every_dynamic_slot, and the guard's place in a_capped_view_heap_keeps_its_dynamic_slots. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…Marvisak#358 Marvisak#89 Marvisak#331 Marvisak#86 Marvisak#83 Marvisak#211 Marvisak#260 Marvisak#275) Conflict in crates/victory-gpu/src/descriptor/host.rs: gpu-state (Marvisak#251) moved the dynamic-slot search into free_table(); gpu-draw (Marvisak#86) bounds the search by the heap's spare slots instead of DYNAMIC. free_table() works over taken.len(), which is the spare count, so the helper is kept with gpu-draw's spare-based cursor wrap. Both sides' tests kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… & shader ops - Prefer high-performance discrete GPU via IDXGIFactory6::EnumAdapterByGpuPreference and VICTORY_ADAPTER (index or name substring) in victory-gpu and victory-shader (Marvisak#208/Marvisak#1132) - Cap shader-visible sampler heaps at D3D12's 2,048 architectural limit instead of failing heap creation (Marvisak#100/Marvisak#86) - Fall back to the in-memory translated shader if shader-cache disk write fails (Marvisak#358) - Add F11 / Alt+Enter borderless fullscreen toggle and clean WM_CLOSE handling to both title windows (lifecycle.rs) and VIctory's fallback window (host.rs); clamp fit_into() dimensions to >= 1 (Marvisak#451) - Enhance PC keyboard+mouse fallback gamepad with Space/LShift/R/LCtrl aliases, LMB/RMB/MMB triggers, and RMB/F9 mouse camera look; support null-device cross-device previous/next reading walk (Marvisak#361) - Fall back to a no-op display deferral when PowerSetRequest returns ERROR_NOT_SUPPORTED - Clamp short virtual-drive '..' paths at the virtual drive root (Marvisak#182) - Wake and cancel sleeping delayed callbacks immediately on XTaskQueueTerminate (Marvisak#132) - Cache XMA IMDCT rotation sin/cos tables across subframes (Marvisak#172) - Lower additional RDNA2 VALU instructions (v_mul_hi_{u,i}32_{u,i}24, v_mad_{u,i}32_{u,i}16, v_lerp_u8, v_sad_u{8,16,32}, v_cvt_pk_{u,i}16_{u,i}32, v_dot{2,4}_{i,u}32_{i,u}{16,8}) with DXIL validation and conditional INT64 feature flagging (Marvisak#157) - Add portable victory.toml lookup next to victory.exe, interactive [S] Setup wizard and [K] Controls guide in victory.exe, and scripts/build-windows.ps1 release packager Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
|
Automated triage for the maintainers. Closing because another open pull request covers the same change. See #1032. Same issue (#65, title sampler heap past 2,048) as #1032, with extra dynamic-slot machinery for sampler tables; no test title has a sampler heap past 2,048 (Grand Theft Auto VI's are 128), so the 15-line cap is enough. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution. |
Code tree of fxceless/victory-fork 4e17478 (all rendering work by its author and the VIctory contributors) with, on top: - AMD fixes: skip of 39f0e9aeb156a61c, 32-lane programs per half wave and NaN/Inf filter, configurable texture upload queue, VIctory Marvisak#1599 - upstream VIctory Marvisak#334 (buffer-state tracking) and Marvisak#1271 (globally coherent glc UAVs) - fork PRs Marvisak#95, Marvisak#71, Marvisak#32, Marvisak#86; VIctory Marvisak#1696, Marvisak#1338, Marvisak#1291, Marvisak#1732 - DirectStorage page lists read at the title's submit (analysis by JappertjeV, klbf-lab#3) - offline pipeline pre-build that saves as it goes and skips driver-crashing pipelines - Series S plane composition, VICTORY_FFX_SIMPLE, scripted keys in release builds - docs/klbf/skip-amd.txt: AMD skip list used for our runs
…K 2.4 DLLs (VICTORY_FFX_DIR) (fxceless/victory-fork Marvisak#86)
Fixes #65. Covers the half #74 leaves open; the two conflict in
HostHeap::new, so one of them should go in.What
A title sampler heap larger than
D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE(2,048) madeHostHeap::newreturnNone, whichDescriptor::host()cached for good.Such a heap is now capped at 2,048 host slots up front: the title's first 1,792 and 256 dynamic ones. Tables reaching past the kept title slots go through the existing
State::tablespath (#21) and are made afresh in the dynamic slots, as tables past a capped view heap already are.HostHeapcounts its dynamic slots per heap (spare):DYNAMICfor view heaps,SAMPLER_DYNAMICfor capped sampler heaps, none for sampler heaps within the limit.dynamic/releaseuse it instead ofDYNAMIC.make_aton a sampler heap falls back to a null sampler, not a null view, when the host cannot make the slot (same guardmirroralready has).HostHeap::with.Difference from #74
#74 retries at 2,048 only when the host refuses the bigger heap, and keeps no dynamic slots, so sampler tables past the cap still read past the heap. Here the cap is applied whenever the title asks for more than the spec limit, so behaviour does not depend on whether a driver accepts an out-of-spec heap (the RX 7600 in #74 does).
#83 (null-fill staging heap sized for samplers) is independent and still applies on top.
Verification
large_sampler_heap_is_capped(count, dynamic allocation up toSAMPLER_DYNAMIC, release and reuse) andsmall_sampler_heap_has_no_dynamic_slots. They run on the host device (RX 6700 XT, Windows 11) and skip without one.cargo test --workspace: all pass.cargo clippy -p victory-gpu --all-targets: nothing new.cargo xtask policy: ok.