Repository navigation
GPU: cap a shader-visible sampler heap at 2,048 instead of losing it - #100
Luislariosss wants to merge 1 commit into
Conversation
HostHeap::new had a portable-limit fallback only for view heaps, guarded by !sampler. D3D12 caps a shader-visible sampler heap at D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE (2,048) on every resource binding tier, so a title asking for more failed CreateDescriptorHeap, HostHeap::new returned None, Heap::host() cached that None in its OnceLock for the rest of the run, and State::bind dropped the sampler heap from SetDescriptorHeaps without saying anything. The decision moves into a pure cap_for(sampler, count, extra) that returns the total and the mirrored count to use, and one Err arm consults it for both kinds of heap, so the view behaviour is unchanged and samplers now cap at 2,048 with a warning that names the request and the cap. The bookkeeping uses the final total (GPU_RANGES, kept, fill_null), a sampler heap no longer reserves an unused DYNAMIC-sized dynamic-slot vector, fill_null sizes its null block to min(total, BLOCK) and returns early for a total of 0, and the "title slot past the host heap" diagnostic counts sampler and view slots separately. State::bind now warns once when a bound heap has no host heap instead of dropping it silently, and a sampler index past the host heap is not queued for a fresh copy, which could never be made. cargo test -p victory-gpu: 41 passed, 0 failed. cargo clippy -p victory-gpu --all-targets: clean. The two new tests cover the cap boundaries for both heap kinds, including u32::MAX. Issue Marvisak#65.
|
For completeness, the whole workspace on this branch, not just
|
|
Tested
Coordination note: #74 and #86 are open for the same #65 and change the same No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent). |
|
Thanks for the Wine/vkd3d run, and for flagging the duplication - that is worth settling before review time is spent three ways. #74 is already closed, so it is #86 against this one. I read #86 and ran it here (AMD RX 9060 XT, RDNA4, Windows 11 26200, MSVC 2022, Where they differ
My reading#86 is the better design and should be the one merged. Giving a capped sampler heap 256 dynamic slots means a table reaching past 2,048 is still made afresh, which is strictly better than my version: I only warn, and This PR has two small things #86 does not: the pure So: if @faultzonsol wants them, I will post the I have not closed it yet because the choice is yours and #86 has no independent run on AMD yet. My machine can provide one ( AI-assisted. |
… & 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 cap of oversized sampler heaps at 2,048 as #1032 in 125 lines instead of 15. 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. |
Fixes #65.
What
HostHeap::newhad a portable-limit fallback only for view heaps, guarded by!sampler. D3D12 caps a shader-visible sampler heap atD3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE(2,048) on every resource binding tier, so a title asking for more failedCreateDescriptorHeap;HostHeap::newreturnedNone,Heap::host()cached thatNonein itsOnceLockfor the rest of the run, andState::binddropped the sampler heap fromSetDescriptorHeapswithout saying anything.Changes
PORTABLE_SAMPLERS = 2_048next toPORTABLE_VIEWS, naming the D3D12 constant.cap_for(sampler, count, extra) -> Option<(total, mirrored)>, and oneErrarm inHostHeap::newconsults it for both heap kinds. The view behaviour is unchanged (PORTABLE_VIEWStotal, mirroredPORTABLE_VIEWS - extra); a sampler heap caps at 2,048 with a warning that names the request and the cap.GPU_RANGES,kept, andfill_null. A sampler heap no longer reserves an unusedDYNAMIC-sized dynamic-slot vector (dynamic()already returns early for samplers).fill_nullsizes its null block tomin(total, BLOCK)and returns early when the total is 0.title slot past the host heapdiagnostic counts sampler and view slots separately instead of sharing one high-water mark.State::bindwarns once when a bound heap has no host heap instead of dropping it silently, and a sampler index past the host heap is not queued for a fresh copy, which could never be made.The last two are behaviour changes rather than pure additions, so they are the part worth reviewing hardest: a sampler slot past 2,048 cannot be mirrored, and queueing it for
freshonly spent work on a copy thatmirrorthen discards.Tested
The two new tests cover the cap boundary for both heap kinds: sampler at 2,048 (no cap) and 2,049 / 100,000 (capped), view under, at and over
PORTABLE_VIEWS, withextrasubtracted for views and ignored for samplers, plusu32::MAX.Not tested: the title itself. I do not have the game files, so I could not reproduce the original symptom or exercise a real heap over 2,048 entries; the change is verified against the host limit and by unit test only. Nothing here was run against
mainof this repository with a game.I did not run
cargo fmtover the tree: it already reports diffs on untouched files, and the two files here are formatted by hand to match the surrounding style.AI-assisted.