GPU: implement DiscardResource (slot 55) on command lists with region and state checks (fix on a fork) #835
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#835
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?
@geiyiliyabumo on GitHub · 2026-11-24 11:53 UTC · original
ID3D12GraphicsCommandList::DiscardResource(vtable slot55,0x1b8) currently falls intomissing_tableon both older and newer command-list layouts.Tested Fix Ready on Fork
External PR creation is currently restricted (
collaborators_only), so the verified patch is ready on my fork (based onmainffe310e):github.com/geiyiliyabumo/VIctory@735f3afChanges (
crates/victory-gpu/src/list.rs,crates/victory-gpu/src/host.rs):discard_resourceat slot55(0x1b8) on bothLIST_FUNCTIONSandNEWER_LIST_FUNCTIONS, with compile-time Windows ABI size/alignment assertions againstD3D12_DISCARD_REGIONandRECT.HostList::tracked_texture_stateand only forwardsDiscardResourcewhen the current list holds the host texture in a discard-legal state (RENDER_TARGET,DEPTH_WRITE, orUNORDERED_ACCESS) matching the texture's resource flags; null/buffer resources, invalid regions, and untracked/incompatible textures are clean no-ops without introducing spurious barriers.DiscardRegionbounds (subresource range withD3D12_FEATURE_FORMAT_INFOplane count, overflow safety, 2D-only and single-mip-extent rules for rects, non-inverted rect geometry).discard_resource_slot_is_stable,discard_region_validation,discard_requires_matching_state_and_flags,discard_resource_executes_on_guest_queue).Verification (Windows 11 Pro 26100, AMD Radeon RX 9060 XT driver
32.0.32029.2010, Rust1.98.1):cargo xtask policy: PASS (154 files ok)cargo clippy --workspace --all-targets --locked -- -D warnings: PASScargo clippy --workspace --all-targets --features diagnostics --locked -- -D warnings: PASScargo test -p victory-gpu --locked -- discard --nocapture: 4/4 PASS (live discard adapter: AMD Radeon RX 9060 XT)VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked -- discard --nocapture: 4/4 PASS (live discard adapter: Microsoft Basic Render Driver)cargo test --workspace --locked: PASS (0 failed)AI-assisted; synthetic tests only, no game files.
@fuzeofficlal on GitHub · 2026-11-24 12:10 UTC · original
I tested a valid first-use case on
735f3af. One DIRECT list cleared an 8×8 RGBA8 render target and submitted. A fresh DIRECT list then called the guest discard slot before its first clear. On both RTX 5090 and WARP, that discard reached the native call zero times. The same-list control after a clear reached it once.Follow-up
17cd278uses the existing submission prelude for the first RT or depth use, after region validation. The same probe then observed one native call for each RTV case on both adapters and read back the expected post-clear color. A D32 texture created inDEPTH_WRITEalso forwarded its first-use discard and completed a depth clear on both adapters.The three existing slot, region and state tests passed, along with diagnostics Clippy and the asset check. The follow-up applies directly on top of your branch.
@nopsled0x on GitHub · 2026-11-24 12:43 UTC · original
I checked
feat/list-discard-resource(735f3af, on top offfe310e) on Windows 10, debug build:cargo test -p victory-gpu --locked -- discard: 4/4 pass on a real adapter (NVIDIA GeForce RTX 5060 Ti) and 4/4 on WARP (VICTORY_D3D12_WARP=1with--features diagnostics).discard_resource_executes_on_guest_queueran (was not skipped) in both runs, on the RTX 5060 Ti and on WARP.cargo clippy -p victory-gpu --all-targets --locked -- -D warnings: clean.extern "system"function.17cd278(from the comment above) also passes the same 4 tests. None of the 4 tests exercises the first-use-on-a-fresh-list case it describes, so I could not confirm that claim by test. From reading the code (not tested), without this follow-up the first use on a fresh list does not reach the native call.Not verified:
cargo test --workspace,xtask policy, workspace-wide clippy, clippy on17cd278, or in-game behavior.AI-assisted verification (Claude); tests were run locally by me.
@wanchudao on GitHub · 2026-11-24 15:46 UTC · original
Tested geiyiliyabumo/VIctory's feat/list-discard-resource branch at
735f3afonWindows 11 Pro build 26300 with an RTX 3070 Ti (driver 610.88), rustc 1.98.1,
MSVC 14.44.35207, and Windows SDK 10.0.26100.0.
cargo test -p victory-gpu --lib discard -- --nocaptureThe four existing discard tests passed, with 0 failures, 0 ignored, and 51 filtered
out. The live guest-queue test printed
live discard adapter: NVIDIA GeForce RTX 3070 Ti.This adds an RTX 3070 Ti result for the existing tests. The run did not cover the
first-use discard case on a fresh command list discussed in this thread.
AI use — DeepSeek Harness (DeepSeek V4.1 Flash) ran the tests and drafted this report.
OpenAI Codex (GPT-6.2 Sol) checked the archived results and revised it.
@Marvisak on GitHub · 2026-11-25 03:54 UTC · original
Automated triage for the maintainers.
The reported gap is fixed in
main: slot 55 (0x1b8, DiscardResource) is no longer missing. Since commit0b35b7fboth method tables incrates/victory-gpu/src/list.rsmap it toignored_state(a no-op, which is valid because a discard only says the contents may be undefined), and the testunordered_access_clears_have_the_same_slots_in_both_layoutspins that slot in both layouts.Forwarding the discard to the host list is a possible optimization on top of that, not a correctness fix. Pull requests are open to everyone again (see #717), so if you want it considered, please open a PR against current
mainthat includes the first-use follow-up from the comments (17cd278), with a measurement showing it helps. Proposed for closing as fixed inmain; this will be closed in 48 hours unless the reporter replies or a maintainer removes the label.Generated by Claude Code