fix(gpu): size view-stride and view-mark tables for dynamic slots and guard heap count overflow #3370
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!3370
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3370"
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?
@reeledMarek on GitHub · 2026-11-26 20:40 UTC · original
reeledMarek:fix/gpu-descriptor-heap-table-slots→main· +90 −33 · 1 files · 1 commits · openSummary
HostHeap::new,write_stride, andset_marksized and bounds-checked thestridesandmarkstables againstcount.max(HEAP_VIEWS)instead ofcount.saturating_add(dynamic).max(HEAP_VIEWS). Whenevercount + dynamic > HEAP_VIEWS, dynamic slots pastHEAP_VIEWSsilently dropped bothVIEW_STRIDESandVIEW_MARKSentries.count + DYNAMICandcount + MIN_DYNAMICinHostHeap::newwere also uncheckedu32additions, risking panic/wraparound on extreme counts, andstrides/markswere allocated before heap creation (wasting upload buffers if heap creation failed or capped atPORTABLE_VIEWS).table_slots(count, dynamic), uses checked addition when sizing the descriptor heap, and allocatesstrides/marksafter heap creation fortable_slots(count, extra).stride_and_mark_tables_cover_dynamic_slots_and_handle_overflow.Verification
cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningscargo test -p xtask --locked@Dukestar69 on GitHub · 2026-11-26 20:48 UTC · original · approved these changes
LGTM — verified on RTX 5090 (Windows / D3D12) against
origin/main(63bcca4).cargo test -p victory-gpu --lib descriptor::host::tests:: -- --skip dynamic_slots_are_held_until_released --test-threads=1: 15 passed, 0 failed (includingstride_and_mark_tables_cover_dynamic_slots_and_handle_overflow).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-26 21:11 UTC · original · approved these changes
Solid fix for dynamic-slot bounds in
VIEW_STRIDES/VIEW_MARKSand heap count overflow incrates/victory-gpu/src/descriptor/host.rs:table_slots(count, dynamic)(host.rs:105-109) ensures bothstrides(write_stride,L521) andmarks(set_mark,L539) cover every dynamic slot pastHEAP_VIEWSas well as all clamped shader indices belowHEAP_VIEWS, and moving their allocation after heap creation (L174-189) avoids wasted upload buffers on failed or capped heaps while keeping capacity consistent with the final(count, extra).count.checked_add(DYNAMIC)/count.checked_add(MIN_DYNAMIC)(L144, L151) safely cap overflowing view-heap counts (u32::MAX) atPORTABLE_VIEWSwithout panicking or wrapping, and samplerHostHeap::new(true, u32::MAX)returnsNonecleanly.origin/main63bcca43,VICTORY_D3D12_DEBUG=1):cargo xtask policy(191 files ok) andcargo clippy --locked -p victory-gpu --tests -- -D warnings(default and--features diagnostics) pass cleanly.descriptor::host::tests::*pass on both NVIDIA GeForce RTX 5090 (15/15 skipping the known NVIDIA 1M-capdynamic_slots_are_held_until_released) and Microsoft WARP (16/16).CreateDescriptorHeaplimits across all three local adapters to verify both capped and uncapped paths:0x10de):1M=true, 2M=false, 2,358,272=false— exercises thePORTABLE_VIEWScap (count=934,464, dynamic=65,536, expected_slots=2,097,152).0x1414):1M=true, 2M=true, 2,358,272=false— also caps cleanly atPORTABLE_VIEWSforviews - 1024 + DYNAMIC.0x1002, integrated):1M=true, 2M=true, 2,358,272=true— confirms uncapped Tier-3 hardware reachesend = 2,358,272 > HEAP_VIEWS, wheretable_slotsprevents dropped dynamic-slotstrides/markswrites.LGTM!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.