Reject overlapping linear slices in volume texture copies #1053

Open
teecil wants to merge 1 commit from upstream-pr/1055 into main
teecil commented 2026-11-25 17:44:13 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by teecil on 2026-11-25T17:44:13Z.


Layout::tile and Layout::detile accepted a linear depth pitch one byte shorter than an active slice. In detile, the first row of the next slice then overwrote the last active byte of the previous slice. In tile, both slices read that same byte.

Check the span of one active slice before either copy starts. The minimum pitch ends after the last active row byte, so tightly packed slices can still omit the last row's trailing padding. Keep checked arithmetic for the whole buffer span.

Verification

  • The same regression test fails on ca8829f and passes with the patch. It exercises both copy directions with linear and 4 KB swizzled textures, checks that rejected copies leave their destinations intact, and verifies the exact valid pitch.
  • cargo build --workspace --locked passes with the pinned Rust 1.98.1. The repository asset policy also passes.
  • cargo test --workspace --locked --no-fail-fast -- --test-threads=4 exits successfully on Windows. Cargo reports 582 passed, 12 ignored, and zero failures. Four shader differential tests that Cargo reports as passed exit early because a console compiler is unavailable.
  • Strict Clippy passes for victory-formats. The default and all-features workspace runs reproduce the same existing victory-gpu diagnostics as ca8829f.
  • On an RTX 3060 with driver 621.35, synthetic D3D12 texture upload and readback passed before and after the patch. The separate GPU timestamp benchmark reported a median of 0.02 µs per draw in both builds for 10,000 one-triangle draws with no state changes.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6610281166 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1055). Originally posted by [teecil](https://github.com/teecil) on 2026-11-25T17:44:13Z. --- `Layout::tile` and `Layout::detile` accepted a linear depth pitch one byte shorter than an active slice. In `detile`, the first row of the next slice then overwrote the last active byte of the previous slice. In `tile`, both slices read that same byte. Check the span of one active slice before either copy starts. The minimum pitch ends after the last active row byte, so tightly packed slices can still omit the last row's trailing padding. Keep checked arithmetic for the whole buffer span. ## Verification - The same regression test fails on `ca8829f` and passes with the patch. It exercises both copy directions with linear and 4 KB swizzled textures, checks that rejected copies leave their destinations intact, and verifies the exact valid pitch. - `cargo build --workspace --locked` passes with the pinned Rust 1.98.1. The repository asset policy also passes. - `cargo test --workspace --locked --no-fail-fast -- --test-threads=4` exits successfully on Windows. Cargo reports 582 passed, 12 ignored, and zero failures. Four shader differential tests that Cargo reports as passed exit early because a console compiler is unavailable. - Strict Clippy passes for `victory-formats`. The default and all-features workspace runs reproduce the same existing `victory-gpu` diagnostics as `ca8829f`. - On an RTX 3060 with driver 621.35, synthetic D3D12 texture upload and readback passed before and after the patch. The separate GPU timestamp benchmark reported a median of 0.02 µs per draw in both builds for 10,000 one-triangle draws with no state changes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1055:upstream-pr/1055'
git switch 'upstream-pr/1055'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1055'
git switch 'upstream-pr/1055'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1055'
git switch 'upstream-pr/1055'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1055'
git switch 'main'
git merge --squash 'upstream-pr/1055'
git switch 'main'
git merge --ff-only 'upstream-pr/1055'
git switch 'main'
git merge 'upstream-pr/1055'
git push origin 'main'
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
fxceless/victory-fork!1053
No description provided.