GPU: cap shader-visible sampler heaps at 2048 descriptors #744
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#744
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@flaxdmin199 on GitHub · 2026-11-24 09:18 UTC · original
Problem
On D3D12, shader-visible sampler descriptor heaps are strictly limited to 2048 descriptors (
D3D12_MAX_SHADER_VISIBLE_SAMPLER_HEAP_SIZE = 2048) across all resource binding tiers.When a title allocates a shader-visible sampler descriptor heap with
count > 2048(e.g. 4096 or more as a block allocation):HostHeap::new(true, count)invokedmake(count)which failed withE_INVALIDARG.!sampler, causing sampler heaps > 2048 to fall into the error branch and returnNone.Descriptor::host()cachedNoneinOnceLock.draw::State::bind()filtered descriptor heaps viafilter_map(|&h| heap(h).host()), completely dropping the sampler heap fromSetDescriptorHeaps().HostHeap::fill_null(), a hardcodedBLOCK = 1 << 16(65,536) CPU descriptor heap was created to seed null descriptors, which also failed for sampler heaps.draw::State::tables(), any table extending pasthost.count()was unconditionally added tofresh(dynamic table creation), which is specific to 32-byte view descriptors and always failed for sampler tables (host.dynamic()returnsNonefor samplers).Fixes #65. Refs #21.
Solution
crates/victory-gpu/src/descriptor/host.rs):PORTABLE_SAMPLERS: u32 = 2048.HostHeap::new(), whensampler && requested > PORTABLE_SAMPLERS, capped host heap creation toPORTABLE_SAMPLERS(2048) with a descriptivetracing::warn!, mirroring thePORTABLE_VIEWSbehavior.crates/victory-gpu/src/descriptor/host.rs):fill_null(), capped temporary block allocation tolet block_size = BLOCK.min(total). For sampler heaps,block_sizeis at most 2048, allowing successful creation and initialization of null point samplers.crates/victory-gpu/src/draw.rs):State::tables(), guardedfresh.push(u.slot)with!heap.samplers() && index >= host.count()so sampler tables are not misrouted to the view dynamic-slot allocator.descriptor::host::tests::sampler_heap_larger_than_2048_is_cappedverifying thatHostHeap::new(true, 4096)creates a valid heap of count 2048 and maintains device health.descriptor::tests::sampler_heap_larger_than_2048_creates_host_heapverifying end-to-end descriptor heap creation and host heap association.Verification
rustc 1.98.1 (48a229cea 2026-09-01)sampler_heap_larger_than_2048_is_cappedpanicked withsampler heap capped at 2048 should be created(exit code 1).cargo test -p victory-gpu->50 passed; 0 failedcargo test -p victory-gpu --features diagnostics->52 passed; 0 failedVICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics->52 passed; 0 failedcargo clippy --workspace --all-targets->0 warningsin changed filescargo clippy -p victory --features diagnostics --all-targets->0 warningscargo test --workspace-> All workspace test suites passedcargo xtask policy->asset policy: 151 files okcargo build --release -p victory-> Compiled successfullycargo build --profile diag -p victory --features diagnostics-> Compiled successfullyNot tested / Scope
Branch
@Conrage on GitHub · 2026-11-24 09:54 UTC · original
For whoever reviews the fixes for #65: open PRs #86 and #100 address the same sampler-heap cap, so this branch, #86 and #100 are three versions of one fix. Still reproducible on main at
8e79c80(crates/victory-gpu/src/descriptor/host.rs:98-105returnsNonefor a sampler heap the host refuses).@LAKSHYA-cmd-tech on GitHub · 2026-11-24 10:00 UTC · original
Implemented and verified on branch:
https://github.com/LAKSHYA-cmd-tech/VIctory/tree/fix/gpu-descriptor-heaps-caps-and-dynamic-expansionPORTABLE_SAMPLERS: u32 = 2048indescriptor/host.rs.HostHeap::new, sampler heaps requested above 2048 descriptors are capped at 2048 with a warning instead of failing withE_INVALIDARG.fill_null, bounded CPU block allocation size toBLOCK.min(total)so sampler heaps allocate a block of at most 2048 descriptors.draw::State::tables, guardedfresh.push(u.slot)with!heap.samplers() && index >= host.count()to prevent sampler tables from being misrouted to the view dynamic-slot allocator.sampler_heap_larger_than_2048_is_capped.@Marvisak on GitHub · 2026-11-25 03:49 UTC · original
Automated triage for the maintainers.
This is the same defect as #65, which is open and confirmed. On
main,HostHeap::newincrates/victory-gpu/src/descriptor/host.rsstill returnsNonewhen the host refuses a sampler heap, with no capped fallback.fill_nullstill makes its staging heap with a fixedBLOCKof1 << 16. The change is already in open PR #1032 ("GPU: cap oversized sampler heaps", linked to #65), and #83 bounds the null staging heap. Pull requests are open to everyone, so please compare your branch (and LAKSHYA-cmd-tech's) with #1032 and comment there, or open your own PR if yours adds something, such as theState::tablesguard.Proposed close as a duplicate of #65. This issue will be closed in 48 hours unless the reporter replies or a maintainer removes the label.
Generated by Claude Code