fix(gpu): size view-stride and view-mark tables for dynamic slots and guard heap count overflow #3370
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T20:40:33Z.
Summary
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 --lockedImported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T20:48:24Z.
Review: APPROVED
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).
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T21:11:18Z.
Review: APPROVED
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!
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:29:08Z.
Windows 11,
63bcca4+ this PR, Radeon RX 7900 XTX:descriptor::host::tests::stride_and_mark_tables_cover_dynamic_slots_and_handle_overflowby name: 1 passed.cargo test -p victory-gpu --lib: 232 passed / 0 failed / 1 ignored (unpatched63bcca4here: 231).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.Synthetic only. AI-assisted.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.