fix(gpu): skip converting twin copy routes when depth converter is unavailable #3360

Open
github-bot wants to merge 1 commit from github-bot/gh-3360 into main AGit
Owner

@⁠reeledMarek on GitHub · 2026-11-26 20:25 UTC · original
reeledMarek:fix/gpu-twin-copy-missing-converter → main · +62 −5 · 1 files · 1 commits · open

Summary

  • When a depth twin has routes requiring 16-bit <-> 32-bit float conversion (r.depth.is_some()) and converter() returns None, Twin::copy previously skipped the compute conversion pass but still ran the second CopyTextureRegion pass from the unwritten scratch offset (r.depth or r.twin) into the destination texture, corrupting it with uninitialized scratch bytes.
  • Resolves the converter before transitioning resources or recording copies (via a testable copy_with helper), skipping routes that require conversion when no converter is available and returning false early without transitions or incrementing COPIES if no active routes remain.
  • Adds regression test copy_skips_converting_routes_when_converter_is_missing.

Verification

  • cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings
  • cargo test -p xtask --locked
**@⁠reeledMarek** on GitHub · 2026-11-26 20:25 UTC · [original](https://github.com/Marvisak/VIctory/pull/3360) `reeledMarek:fix/gpu-twin-copy-missing-converter` → `main` · +62 −5 · 1 files · 1 commits · open ### Summary - When a depth twin has routes requiring 16-bit <-> 32-bit float conversion (`r.depth.is_some()`) and `converter()` returns `None`, `Twin::copy` previously skipped the compute conversion pass but still ran the second `CopyTextureRegion` pass from the unwritten scratch offset (`r.depth` or `r.twin`) into the destination texture, corrupting it with uninitialized scratch bytes. - Resolves the converter before transitioning resources or recording copies (via a testable `copy_with` helper), skipping routes that require conversion when no converter is available and returning `false` early without transitions or incrementing `COPIES` if no active routes remain. - Adds regression test `copy_skips_converting_routes_when_converter_is_missing`. ### Verification - `cargo clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --locked -- -D warnings` - `cargo test -p xtask --locked`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 20:26:25 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 20:28 UTC · original · approved these changes

LGTM — verified on RTX 5090 (Windows / D3D12) against origin/main (63bcca4).

  • Filtering out converting routes (and their plane barriers) when converter() is unavailable avoids copying unconverted scratch bytes into the destination texture or emitting unnecessary transitions.
  • cargo test -p victory-gpu --lib twin:: -- --test-threads=1: 3 passed, 0 failed (including copy_skips_converting_routes_when_converter_is_missing).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 20:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/3360#pullrequestreview-6080158381) · **approved these changes** LGTM — verified on RTX 5090 (Windows / D3D12) against `origin/main` (`63bcca4`). - Filtering out converting routes (and their plane barriers) when `converter()` is unavailable avoids copying unconverted scratch bytes into the destination texture or emitting unnecessary transitions. - `cargo test -p victory-gpu --lib twin:: -- --test-threads=1`: 3 passed, 0 failed (including `copy_skips_converting_routes_when_converter_is_missing`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3360/head:github-bot/gh-3360'
git switch 'github-bot/gh-3360'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3360'
git switch 'github-bot/gh-3360'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3360'
git switch 'github-bot/gh-3360'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3360'
git switch 'main'
git merge --squash 'github-bot/gh-3360'
git switch 'main'
git merge --ff-only 'github-bot/gh-3360'
git switch 'main'
git merge 'github-bot/gh-3360'
git push origin 'main'
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!3360
No description provided.