GPU: back host sampler heaps with 2,048 slots and reserve slot 2,047 as null sentinel #121
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!121
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-121"
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?
@ESAT586 on GitHub · 2026-11-26 04:44 UTC · original
ESAT586:avatarmanz/sampler-heap-sentinel→main· +30 −2 · 1 files · 1 commits · merged 2026-11-26 08:17 UTC### Problem
victory-shader(emit/shader.rs:498) clamps all direct sampler heap indices viaumin(index, 2047)with the explicit shortcut comment:However,
HostHeap::new(true, count)incrates/victory-gpu/src/descriptor/host.rsallocated onlycountsampler descriptors (leavingnull = 0). When a title creates a sampler heap smaller than 2,048 descriptors, a wild sampler index clamped to2047reads past the end ofSamplerDescriptorHeap(GPU page fault); and whencount == 2048, title mirroring could overwrite slot2047instead of keeping it as a null point sampler.Change
SAMPLERS = 2048descriptors (~32 KiB each) and cap mirrored title slots tocount.min(SAMPLERS - 1)(2047).fill_null(kind, size)already initializes every slot in0..2048with a valid null point sampler, so slot2047(and all slotscount..2048) are permanently safe null sentinels.sampler_heaps_back_2048_slots_and_reserve_null_sentinel.Verification
cargo test -p victory-gpu --locked -- descriptor::host::tests::sampler_heaps_back_2048_slots_and_reserve_null_sentinel --test-threads=1on NVIDIA GeForce RTX 3060 Ti 8 GB: 1 passed, 0 failed.VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked -- descriptor::host::tests::sampler_heaps_back_2048_slots_and_reserve_null_sentinel --test-threads=1: 1 passed, 0 failed.cargo clippy -p victory-gpu --all-targets --all-features --locked: 0 warnings indescriptor/host.rs.cargo xtask policy --staged:asset policy: 1 files ok.@avatarmanz on GitHub · 2026-11-26 07:55 UTC · original
Merged into main in the next push (tests pass); thanks.