GPU: implement ID3D12GraphicsCommandList::ClearState (slot 0x58) #848
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#848
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 12:25 UTC · original
Summary
Implements
ID3D12GraphicsCommandList::ClearState(vtable slot11,0x58) invictory-gpuacross both older (LIST_FUNCTIONS) and newer (NEWER_LIST_FUNCTIONS) console command-list layouts.Because external PR creation is currently restricted (
collaborators_only), the CI-green branch is ready on my fork for cherry-pick / review:geiyiliyabumo/VIctory@feat/list-clear-stategeiyiliyabumo/VIctory@d57ea67(based onmainffe310e)Changes
crates/victory-gpu/src/draw.rs:State::clear(&mut self, pipeline: This)resetting guest bindings (pipeline,heaps,graphics,compute,vertex,index,targets,depth,topology) and cached host state (host_pipeline,host_roots,host_heaps,fresh_tables,table_failed) while preservingself.dynamicdescriptor slots still referenced by earlier recorded commands in the same list.draw::clear_state_tests::clear_resets_bindings_but_retains_dynamic_slots.crates/victory-gpu/src/list.rs:clear_state(this: This, pipeline: This)wired at slot11(0x58) inMETHODS(shared by bothLIST_FUNCTIONSandNEWER_LIST_FUNCTIONS).unsafe { host.list.ClearState(None) }(leaving translated host pipeline binding lazy on the next draw/dispatch), resets guest state viastate.clear(pipeline), preservesHostList::statesresource-state tracking, and records adiagnosticsop note when enabled.list::tests::clear_state_slot_is_stableandlist::tests::clear_state_preserves_recorded_gpu_commands(clears pixel 0 red beforeClearState, verifies trackedRENDER_TARGETstate survivesClearState, clears pixel 1 green afterClearState, submits and verifies[255, 0, 0, 255, 0, 255, 0, 255]readback).Verification (Windows 11 x64 MSVC, AMD Radeon RX 9060 XT RDNA4 + WARP)
cargo xtask policy: PASS (154 files ok)cargo clippy --workspace --all-targets --locked -- -D warnings(default +--features diagnostics): PASS (0 warnings)cargo test -p victory-gpu --locked -- clear_state: 3/3 PASS (live RX 9060 XT GPU readback)VICTORY_D3D12_WARP=1 cargo test -p victory-gpu --features diagnostics --locked -- clear_state: 3/3 PASScargo test --workspace --locked: PASS (all workspace crates green)AI-assisted; synthetic tests only, no game files.
@MichaelSmithAI on GitHub · 2026-11-24 12:55 UTC · original
Melissa checked ClearState together with #158, which adds a dynamic depth range to the list. The two patches apply cleanly, but the saved range survives ClearState and the next bind replays it. With depth cleared to 0.5, a draw after ClearState still failed the old bounds and left 0.5 in the pixel. A draw after Reset wrote the expected 0.25.
The follow-up saves the list's dynamic descriptor allocations, calls the existing guest-state reset helper to clear bindings and saved depth bounds, then restores ownership of the allocations. Earlier recorded commands can still use those slots. On RTX 4090 under Wine/vkd3d-proton 3.2, the draw after ClearState then wrote 0.25. The vertex and mesh readbacks covered fresh, excluded, included, cleared, and reset states. All three original ClearState controls passed, including the two recorded clears.
This is a synthetic result on the combined branches. On #848 alone, the saved-depth-bounds field does not exist. The helper change and readback are available in the integration commit.
@Marvisak on GitHub · 2026-11-25 03:55 UTC · original
Automated triage for the maintainers.
Confirmed missing on
main: slot 11 (0x58, ClearState) is not in theMETHODStable incrates/victory-gpu/src/list.rs, so it falls into the missing table on both list layouts. This change is now open as PR #1166 (same author), so review continues there.The comment above notes that the dynamic depth range from #158 would survive ClearState if both landed. Please raise that on #1166 so whichever lands second resets it.
Generated by Claude Code