GPU: implement ID3D12GraphicsCommandList::ClearState (slot 0x58) #1166

Closed
github-bot wants to merge 1 commit from gh-pr/1166/head into gh-pr/1166/base
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 16:19 UTC · original
geiyiliyabumo:feat/list-clear-state → main · +310 −1 · 2 files · 1 commits · closed without merging

Summary

Closes #848

Full verification details and change notes are documented in #848 (commit d57ea67, based on main ffe310e).

 crates/victory-gpu/src/draw.rs |  82 +++++++++++++++
 crates/victory-gpu/src/list.rs | 219 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 300 insertions(+), 1 deletion(-)

Verification (Windows 11 x64 MSVC)

  • rustfmt --edition 2024 --check on edited files: PASS
  • cargo xtask policy: PASS (zero game files/data)
  • cargo clippy --all-targets --locked -- -D warnings (default + --features diagnostics where applicable): PASS
  • Targeted & crate unit/GPU tests: PASS

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 16:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1166) `geiyiliyabumo:feat/list-clear-state` → `main` · +310 −1 · 2 files · 1 commits · closed without merging ### Summary Closes #848 Full verification details and change notes are documented in #848 (commit `d57ea67`, based on `main` `ffe310e`). ```text crates/victory-gpu/src/draw.rs | 82 +++++++++++++++ crates/victory-gpu/src/list.rs | 219 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 300 insertions(+), 1 deletion(-) ``` ### Verification (Windows 11 x64 MSVC) - `rustfmt --edition 2024 --check` on edited files: **PASS** - `cargo xtask policy`: **PASS** (zero game files/data) - `cargo clippy --all-targets --locked -- -D warnings` (default + `--features diagnostics` where applicable): **PASS** - Targeted & crate unit/GPU tests: **PASS** *AI-assisted; synthetic tests only, no game files.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:21:57 +00:00
github-bot closed this pull request 2026-11-26 04:21:57 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 18:00 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at d57ea67: cargo test -p victory-gpu passes, 53 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 18:00 UTC · [original](https://github.com/Marvisak/VIctory/pull/1166#issuecomment-7140033385) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at d57ea67: `cargo test -p victory-gpu` passes, 53 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:38 UTC · original · edited 2026-11-25 02:23 UTC

Automated triage for the maintainers.

Recommended for a maintainer's look. This fills slot 0x58 (ClearState) in crates/victory-gpu/src/list.rs, which main leaves to the E_NOTIMPL stub. It calls the host's ClearState(None) and resets the list's cached State (State::clear in draw.rs), so the pipeline, root signatures and heaps are bound again before the next draw. The dynamic descriptor slots and the root-view run are kept until reset, because earlier commands may still read them. These semantics match the public D3D12 ClearState documentation. The GPU test reads back a clear recorded before ClearState and another recorded after it, confirming that both run. CI is passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1166#issuecomment-7148721344) · edited 2026-11-25 02:23 UTC <!-- victory-triage v1 head=2d779bf53dcbc5aae9297c0c3ae5717c619d32ec verdict=merge-candidate at=2026-11-25T02:20:29Z --> Automated triage for the maintainers. Recommended for a maintainer's look. This fills slot 0x58 (`ClearState`) in `crates/victory-gpu/src/list.rs`, which main leaves to the `E_NOTIMPL` stub. It calls the host's `ClearState(None)` and resets the list's cached `State` (`State::clear` in `draw.rs`), so the pipeline, root signatures and heaps are bound again before the next draw. The dynamic descriptor slots and the root-view run are kept until reset, because earlier commands may still read them. These semantics match the public D3D12 `ClearState` documentation. The GPU test reads back a clear recorded before `ClearState` and another recorded after it, confirming that both run. CI is passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-25 01:51 UTC · original

Rebased cleanly onto \main\ (\ccfb029). \cargo test -p victory-gpu --locked\ (144 passed, 0 failed), \cargo clippy -p victory-gpu --all-targets --locked -- -D warnings, and \cargo xtask policy\ all pass.

**@⁠geiyiliyabumo** on GitHub · 2026-11-25 01:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/1166#issuecomment-7150045633) Rebased cleanly onto \main\ (\ccfb029\). \cargo test -p victory-gpu --locked\ (144 passed, 0 failed), \cargo clippy -p victory-gpu --all-targets --locked -- -D warnings\, and \cargo xtask policy\ all pass.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 20:40 UTC · original

I tested this PR at 2d779bf merged with current main 13f91ca. The textual merge is clean, but the resulting test build hits E0063 at the State initializer because main added the saved fixed-function state, and E0308 where the existing readback test passes an owned texture to transition.

After adapting only those test call sites, the expanded binding test finds that ClearState leaves the saved topology, viewport, scissor, blend factor, stencil reference and targets available for replay by State::cut. The fix resets that saved state while retaining the descriptor slots and root views used by earlier commands. D3D12 ClearState

Commit bfd5ce0 sits on the merge of your exact HEAD and main, keeping your commits and authorship. With the same tests, the old composition fails the stale-state assertion and the updated composition passes all three ClearState tests. The submitted clear regression still reads red and green from its two texels. Six paired runs reproduced the results. The full serial GPU suite on WARP passed 201 tests with one ignored under each debug setting. Strict Clippy in both configurations and asset policy passed.

Please retain the Git author on cherry-pick or rebase. If you fold the fix or test into another commit, please add the following trailer.

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted with Codex. Synthetic tests on WARP.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 20:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/1166#issuecomment-7174017642) I tested this PR at 2d779bf merged with current main 13f91ca. The textual merge is clean, but the resulting test build hits E0063 at the State initializer because main added the saved fixed-function state, and E0308 where the existing readback test passes an owned texture to transition. After adapting only those test call sites, the expanded binding test finds that ClearState leaves the saved topology, viewport, scissor, blend factor, stencil reference and targets available for replay by State::cut. The fix resets that saved state while retaining the descriptor slots and root views used by earlier commands. [D3D12 ClearState](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-clearstate) [Commit bfd5ce0](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/bfd5ce04f25c336e7c04e2a64779c63ffe3a7656) sits on the merge of your exact HEAD and main, keeping your commits and authorship. With the same tests, the old composition fails the stale-state assertion and the updated composition passes all three ClearState tests. The submitted clear regression still reads red and green from its two texels. Six paired runs reproduced the results. The full serial GPU suite on WARP passed 201 tests with one ignored under each debug setting. Strict Clippy in both configurations and asset policy passed. Please retain the Git author on cherry-pick or rebase. If you fold the fix or test into another commit, please add the following trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted with Codex. Synthetic tests on WARP.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 21:59 UTC · original

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because the title never calls this slot (an unimplemented list slot logs its first call, and no title run has logged 0x58), and the change is incomplete against current main. State gained a fixed field that State::clear does not reset, so a list cut at a wait after ClearState would set the old viewports, scissors, blend factor, stencil reference, topology and targets again; host_heaps is set to [0; 2] where main uses usize::MAX; and the tests no longer compile on main.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 21:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/1166#issuecomment-7175798687) Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because the title never calls this slot (an unimplemented list slot logs its first call, and no title run has logged 0x58), and the change is incomplete against current `main`. `State` gained a `fixed` field that `State::clear` does not reset, so a list cut at a wait after `ClearState` would set the old viewports, scissors, blend factor, stencil reference, topology and targets again; `host_heaps` is set to `[0; 2]` where `main` uses `usize::MAX`; and the tests no longer compile on `main`. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1166
No description provided.