gpu: preserve lowest from offset in shadow::joined_piece_runs #42

Merged
ahmetbagci8 merged 1 commit from upstream-pr/42 into dev 2026-11-29 20:55:34 +00:00
ahmetbagci8 commented 2026-11-29 18:13:32 +00:00 (Migrated from github.com)

Imported from edsuuu/VI-BR-PORT. Originally posted by ahmetbagci8 on 2026-11-29T18:13:32Z.


Problem

In crates/victory-gpu/src/shadow.rs, joined_piece_runs sorts
uns only by
.first and updates last.to = last.to.max(run.to) without updating last.from. When two CardSpans start in the same 64 KiB piece (
un.first == last.first) and the one with the larger rom offset appears first, merging drops [run.from, last.from).

Fix

Sort by (r.first, r.from) and update last.from = last.from.min(run.from) when merging runs. Added unit test joined_piece_runs_preserves_lowest_from_in_same_piece.

Verification

  • cargo test -p victory-gpu --lib joined_piece_runs_preserves_lowest_from_in_same_piece (1 passed, 0 failed)
  • cargo clippy -p victory-gpu --tests (0 warnings)
<!-- greyfinch-sync:edsuuu/VI-BR-PORT:issue:5553626353 --> Imported from [edsuuu/VI-BR-PORT](https://github.com/edsuuu/VI-BR-PORT/pull/42). Originally posted by [ahmetbagci8](https://github.com/ahmetbagci8) on 2026-11-29T18:13:32Z. --- ## Problem In crates/victory-gpu/src/shadow.rs, joined_piece_runs sorts uns only by .first and updates last.to = last.to.max(run.to) without updating last.from. When two CardSpans start in the same 64 KiB piece ( un.first == last.first) and the one with the larger rom offset appears first, merging drops [run.from, last.from). ## Fix Sort by (r.first, r.from) and update last.from = last.from.min(run.from) when merging runs. Added unit test joined_piece_runs_preserves_lowest_from_in_same_piece. ## Verification - cargo test -p victory-gpu --lib joined_piece_runs_preserves_lowest_from_in_same_piece (1 passed, 0 failed) - cargo clippy -p victory-gpu --tests (0 warnings)
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
edsuuu/VI-BR-PORT!42
No description provided.