GPU: presenting a texture already in the copy source state makes no barrier from it to itself #2328

Closed
denkencar-sketch wants to merge 1 commit from upstream-pr/2330 into main
denkencar-sketch commented 2026-11-25 10:42:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T10:42:42Z.


Summary

Presenting a texture that is already in the copy source state made a barrier from that state to itself, which D3D12 refuses. transition_if now makes no barrier when the before and after states are the same.

Testing

Test a_barrier_to_the_same_state_is_not_made fails with the always-barrier behaviour and passes with this change.

cargo test --workspace --locked passes apart from known flakes: modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too, and so does a parallel-run flake in victory-gpu's lib tests (watch:: and descriptor::host:: tests, 2 of 40 runs on pristine main).

This fixes only the same-state barrier. Not fixed: queue::present also reads and restores the texture's host state outside the submitted lock, which can clobber another queue's tracked state; that needs a presenter window to test. Not tried: a run in the game.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6602638850 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2330). Originally posted by [denkencar-sketch](https://github.com/denkencar-sketch) on 2026-11-25T10:42:42Z. --- ## Summary Presenting a texture that is already in the copy source state made a barrier from that state to itself, which D3D12 refuses. `transition_if` now makes no barrier when the before and after states are the same. ## Testing Test `a_barrier_to_the_same_state_is_not_made` fails with the always-barrier behaviour and passes with this change. `cargo test --workspace --locked` passes apart from known flakes: `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too, and so does a parallel-run flake in `victory-gpu`'s lib tests (`watch::` and `descriptor::host::` tests, 2 of 40 runs on pristine `main`). This fixes only the same-state barrier. Not fixed: `queue::present` also reads and restores the texture's host state outside the `submitted` lock, which can clobber another queue's tracked state; that needs a presenter window to test. Not tried: a run in the game. AI-assisted.
catminou4 commented 2026-11-25 11:04:58 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:54:12Z.

Review: COMMENTED


A texture already in the copy source state gets no same-state barrier (transition_if None). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Includes host-gated test.

<!-- greyfinch-sync:Marvisak/VIctory:review:6056245606 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2330#pullrequestreview-6056245606). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T10:54:12Z. **Review:** COMMENTED --- A texture already in the copy source state gets no same-state barrier (transition_if None). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Includes host-gated test.
DenRakEiw commented 2026-11-25 12:03:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T11:31:44Z.

Review: APPROVED


Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Avoiding redundant resource barriers when a presented texture is already in COPY_SOURCE cleanly prevents self-transition barriers.
  • cargo test -p victory-gpu host::tests::: all 7/7 host::tests::* passed on RTX 5090 and 7/7 on WARP (including a_barrier_to_the_same_state_is_not_made; only the pre-existing NVIDIA #1744 baseline failure in descriptor::host::tests::dynamic_slots_are_held_until_released matched the substring).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6056827395 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2330#pullrequestreview-6056827395). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T11:31:44Z. **Review:** APPROVED --- Verified against `origin/main` (`940d32f`) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP: - Avoiding redundant resource barriers when a presented texture is already in `COPY_SOURCE` cleanly prevents self-transition barriers. - `cargo test -p victory-gpu host::tests::`: all 7/7 `host::tests::*` passed on RTX 5090 and 7/7 on WARP (including `a_barrier_to_the_same_state_is_not_made`; only the pre-existing NVIDIA #1744 baseline failure in `descriptor::host::tests::dynamic_slots_are_held_until_released` matched the substring). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings. - `cargo xtask policy`: 183 files ok. AI-assisted (Gemini 4 Neon).
Marvisak commented 2026-11-25 16:09:33 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:23:02Z.


Automated triage for the maintainers.

This pull request no longer merges cleanly into main (conflicts in crates/victory-gpu/src/host.rs). It will be reviewed once it is rebased onto the current main. The earlier verdict (merge-candidate) was for an older state of main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166756686 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2330#issuecomment-7166756686). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:23:02Z. --- <!-- victory-triage v1 head=e4e2985a2f3b1eddf7689e6ac2cf43079e2f1af0 verdict=needs-rebase at=2026-11-25T15:58:00Z --> Automated triage for the maintainers. This pull request no longer merges cleanly into `main` (conflicts in `crates/victory-gpu/src/host.rs`). It will be reviewed once it is rebased onto the current `main`. The earlier verdict (merge-candidate) was for an older state of `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
upstream-sync closed this pull request 2026-11-26 00:01:53 +00:00
denkencar-sketch commented 2026-11-26 00:03:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T23:30:24Z.


Closing as superseded: #1997 (\

<!-- greyfinch-sync:Marvisak/VIctory:comment:7177654609 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2330#issuecomment-7177654609). Originally posted by [denkencar-sketch](https://github.com/denkencar-sketch) on 2026-11-25T23:30:24Z. --- Closing as superseded: #1997 (\

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2328
No description provided.