Skip to content

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

Open
reeledMarek wants to merge 1 commit into
Marvisak:mainfrom
reeledMarek:fix/gpu-twin-copy-missing-converter
Open

reeledMarek wants to merge 1 commit into
Marvisak:mainfrom
reeledMarek:fix/gpu-twin-copy-missing-converter

Conversation

@reeledMarek

Copy link
Copy Markdown
Contributor

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

@Dukestar69 Dukestar69 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants