Reject overlapping linear slices in volume texture copies #1055

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

@⁠teecil on GitHub · 2026-11-25 17:44 UTC · original
teecil:fix/texture-linear-depth-pitch → main · +49 −4 · 1 files · 1 commits · open

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.
**@⁠teecil** on GitHub · 2026-11-25 17:44 UTC · [original](https://github.com/fxceless/victory-fork/pull/1055) `teecil:fix/texture-linear-depth-pitch` → `main` · +49 −4 · 1 files · 1 commits · open `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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:56:46 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1055/head:github-bot/gh-1055'
git switch 'github-bot/gh-1055'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1055'
git switch 'github-bot/gh-1055'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1055'
git switch 'github-bot/gh-1055'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1055'
git switch 'main'
git merge --squash 'github-bot/gh-1055'
git switch 'main'
git merge --ff-only 'github-bot/gh-1055'
git switch 'main'
git merge 'github-bot/gh-1055'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.