GPU: cap a refused sampler heap and remap its past-cap tables #74
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!74
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/74/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?
@WallasSCRIPTS on GitHub · 2026-11-24 00:14 UTC · original
WallasSCRIPTS:gpu/sampler-heap-cap→main· +76 −11 · 1 files · 2 commits · closed without mergingRelates to #65.
What
A sampler heap larger than
D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE(2,048) that the host refused made
HostHeap::newreturnNone. The genericerror arm had no fallback, unlike view heaps which cap at 1,000,000.
Losing the heap is worse than losing the slots:
draw::State::bindbuildsSetDescriptorHeapswithfilter_map(...host()), so a heap without a hostis dropped and the heap indices the translated root signature expects shift.
This PR:
asked for, what the host made, and what was lost. The heap stays bound.
HostHeap::dynamic/releaseuse them.State::tablesalready remakes atable with an entry past
host.count(), so sampler tables past the capnow take that path instead of being skipped. An uncapped sampler heap
keeps all 2,048 slots for the title.
count.saturating_add(extra)keeps a title asking foru32::MAXon the cappath rather than overflowing in a debug build.
Driver note
Some drivers accept a 2,049-slot sampler heap — the RX 7600 here does. The
test forces the refusal with
u32::MAXso the path is exercised on any host.Verification
cargo test -p victory-gpu: 41 passed, 0 failed.cargo clippy -p victory-gpu --all-targets: clean.rustfmt --edition 2024clean. The file haspre-existing formatting drift elsewhere, untouched here.
no title was run.
@WallasSCRIPTS on GitHub · 2026-11-24 00:25 UTC · original
Closing in favour of #86, which is the better design and covers the same
ground. #74 only capped when the host refused an over-limit sampler heap;
the RX 7600 here accepts one, so behaviour depended on the driver. #86 caps
at the spec limit up front and gives the capped heap its 256 scratch slots,
so
State::tablesremaps past-cap sampler tables on every host. It alsofixes the null-sampler fallback and reports an oversized table instead of
dropping it. One PR for #65 is enough.
One suggestion if it helps: the cap warning currently logs only
count.Reporting
wanted,madeandlostlike the view-heap warning in #35makes a tester's log self-explanatory without a second diagnostic run.
Verified on my branch before closing:
cargo test -p victory-gpu41 passed,clippy clean. No title run.
Pull request closed