GPU: refresh and transition ResourceDescriptorHeap views before draws #1544
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!1544
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1544/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?
@n-romanovich on GitHub · 2026-11-24 19:01 UTC · original
n-romanovich:fix/bindless-resource-refresh→main· +182 −1 · 3 files · 3 commits · closed without mergingSummary
Fixes Issue #754.
Brings resources accessed through
ResourceDescriptorHeap[](RootType::ResourceHeapand dynamic bindless indexing) up to date before draws and dispatches:crates/victory-gpu/src/descriptor/host.rs: track written title view slots (live_slots) and a monotonicgenerationcounter (bumped on view writes, updates, and slot invalidations).crates/victory-gpu/src/descriptor.rs: exposeforgotten_epoch()bumped inforget()so stale/released resources are invalidated immediately.crates/victory-gpu/src/draw.rs:RootType::ResourceHeapentries viaState::heap_entry.State::refresh_heapto mirror deferred buffer views, refresh shadow buffers, upload title-written textures, and transition SRVs toSHADER_RESOURCE(skipping active render/depth targets), cached per(host_heap_ptr, generation, forgotten_epoch)per command list.shader_visible_heap_tracks_live_slots_and_generation.Testing
Tested on Windows 11, NVIDIA GeForce RTX 5060 Ti:
cargo clippy --workspace --all-targets --locked -- -D warnings(pass)cargo clippy --workspace --all-targets --all-features --locked -- -D warnings(pass)cargo test -p victory-gpu --locked(51 passed, 0 failed, 1 ignored)AI-assisted: implemented and reviewed with AI assistance.
@n-romanovich on GitHub · 2026-11-24 20:17 UTC · original
Updated in
78fd990:Gated refresh_heap() on pipelines that actually use RootType::ResourceHeap so non-bindless UI/2D draws avoid unnecessary heap sweeps and stay at 30 fps.
Removed the unconditional shadow.gpu_writes() call inside refresh_heap() (explicit UAV entries are still handled via heap_entry()), eliminating redundant readback overhead.
@titilyonnais on GitHub · 2026-11-24 21:15 UTC · original
Tested on AMD (RX 9070 XT): the world lasted longer, then a page fault inside freed textures
Setup: Windows 11 (build 26300), AMD RX 9070 XT (driver 32.0.32029.2010), retail dump 1.0.2.1.
mainatffe310e, with and without this PR merged on top (no conflicts), both built withcargo build --profile diag -p victory --features diagnostics.cargo test -p victory-gpupasses with the PR (51 passed, 1 ignored). Both runs usedVICTORY_D3D12_DEBUG=1 VICTORY_D3D12_DRED=1 VICTORY_GPU_TIMING=1and the same shader cache, up to the intro mission in the world.mainmain+ #1544The two faults are not the same:
main:page fault at 0x45f4ee000, just past the end of a title memory copy (0xcaec00000+0x400000 at host 0x45f000000, offset 0x4ee000), and the report also hasview heap 0x102800000+0x2e00000: 0x359eee000 past its end.page fault at 0x5dcbe6000; inside freed ["texture 1024x1024 f98 flags 0x0 (type 34)", "texture 2048x2048 f98 flags 0x0 (type 34)"]. The commands in flight are mesh draws (8b07450f04377f14,264ae8d58e78b62d,633c1f8872ed8c6d), whose tables all name placed SRVs.So with the PR, the title lasts about three times longer in the world on this card, with no frame-time cost, and the fault moves to freed placed textures. I have not looked into which draw reads those textures or why.
Caveats: one run of each, and the world's streaming differs from run to run, so the 77 s vs 223 s needs more runs before it means much. I also did not check how often
refresh_heapactually ran (it only runs for pipelines with aResourceHeapentry). I can do more runs if that helps.@aycow on GitHub · 2026-11-24 21:51 UTC · original
@n-romanovich The same zero-instance mechanism reported in #71 has relevant changes on main
70564ae, notablyc75fdba,4051149andbacb06a. We are building an independent synthetic control around a GPU-produced descriptor index, a known nonzero instance record and visibility/indirect argument readback. Have you seen a valid, still-null bindless buffer on this exact main, or a reproducible descriptor-lifetime or refresh gap that #1544 still fixes? An aggregate control could distinguish intentionally refused empty or out-of-bounds views from a valid view left null. We will keep the fixture separate from your implementation.AI-assisted using Codex.
@aycow on GitHub · 2026-11-24 21:58 UTC · original
The independent synthetic control now passes on exact
70564aeplus tests on AMD and WARP with full GPU-based validation. A GPU-written index selected live or native-null slots for the same title buffer. The live path read the expected nonzero position, wrote visibility and args (1,1,1), and changed a sentinel via native ExecuteIndirect. The null control read zero, wrote (0,1,1), and left the sentinel intact. A later live read saw the updated record.This gives us a reference for the current-main title comparison. Aggregate live/null counts, whether a null was refused as empty or out of bounds, the matching nonzero read/visibility counts, indirect groups, and the outcome at presentation would distinguish the remaining cases. The fixture does not exercise concurrent heap replacement, eager loading pressure, or title rendering.
AI-assisted using Codex.
@Marvisak on GitHub · 2026-11-25 00:42 UTC · original
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.the new head is the same change rebased; main brings heap-indexed views up to date per submission (bindless.rs, Step::Heap in Host::execute), while this walks every live heap slot per draw.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed