Return early on empty ranges in texback::remapped, port::forget, and port::touches #454

Closed
ahmetbagci8 wants to merge 660 commits from upstream-pr/454 into main
ahmetbagci8 commented 2026-11-29 18:18:25 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by ahmetbagci8 on 2026-11-29T18:18:25Z.


Problem

In crates/victory-gpu/src/texback.rs (
emapped) and crates/victory-gpu/src/port.rs ( orget and ouches), half-open range checks did not return early when len == 0:

  • exback::remapped(at, 0) evaluated t < ticket.end && ticket.at < at to rue for any ticket with icket.at < at < ticket.end, falsely invalidating a live readback ticket.
  • port::forget(at, 0) evicted any live region strictly containing t, and port::touches(at, 0) returned rue when BOUNDS[0] < at < BOUNDS[1].

Fix

Return early on len == 0 in exback::remapped, port::forget, and port::touches, with unit tests covering each case.

Verification

  • cargo test -p victory-gpu --lib -- texback::tests port::tests (4 passed, 0 failed)
  • cargo clippy -p victory-gpu --tests (0 warnings)
<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5553668268 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/454). Originally posted by [ahmetbagci8](https://github.com/ahmetbagci8) on 2026-11-29T18:18:25Z. --- ## Problem In crates/victory-gpu/src/texback.rs ( emapped) and crates/victory-gpu/src/port.rs ( orget and ouches), half-open range checks did not return early when len == 0: - exback::remapped(at, 0) evaluated t < ticket.end && ticket.at < at to rue for any ticket with icket.at < at < ticket.end, falsely invalidating a live readback ticket. - port::forget(at, 0) evicted any live region strictly containing t, and port::touches(at, 0) returned rue when BOUNDS[0] < at < BOUNDS[1]. ## Fix Return early on len == 0 in exback::remapped, port::forget, and port::touches, with unit tests covering each case. ## Verification - cargo test -p victory-gpu --lib -- texback::tests port::tests (4 passed, 0 failed) - cargo clippy -p victory-gpu --tests (0 warnings)
TaynanGT commented 2026-11-29 19:09:17 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-29T19:09:17Z.


Thanks for the consistent half-open range handling. I checked the diff: empty remaps preserve live readback tickets and empty forgets preserve registered regions. The positive nonempty invalidation tests should remain alongside these regressions.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7261051954 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/454#issuecomment-7261051954). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-29T19:09:17Z. --- Thanks for the consistent half-open range handling. I checked the diff: empty remaps preserve live readback tickets and empty forgets preserve registered regions. The positive nonempty invalidation tests should remain alongside these regressions.
TaynanGT commented 2026-11-30 17:05:48 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:05:48Z.


main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7285712219 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/454#issuecomment-7285712219). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T17:05:48Z. --- `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

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
TaynanGT/Vice-Tay!454
No description provided.