Reject overlapping depth slices before copying a volume texture #65

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

@⁠Yoshi-233 on GitHub · 2026-11-26 03:29 UTC · original
Yoshi-233:fix/volume-copy-depth-pitch → main · +47 −5 · 1 files · 1 commits · open

A 2×2×2 R8 volume with two active bytes per row and a four-byte row pitch needs six bytes before the next depth slice may start. On 64bd58f, pitches of 0 and 5 were accepted in both copy directions, allowing one slice to overwrite or reuse the previous slice’s texels.

Check the occupied extent through the last active byte of a slice before copying. This preserves DexNom’s bytes_from(mip) limit for streamed mips. The next slice may start at byte 6; a single-slice mip still accepts a depth pitch of 0.

This ports Belobug/VIctory-Belobug-AMD#21, where I previously called the exported XG texture computer and its actual copy methods on native Windows build 26200. Those measurements exercise CPU-side layout and copy semantics.

Checks on DexNom

  • Reproduced the new regression test on base (Ok(()) for an overlapping pitch). After the fix, cargo test --locked -p victory-formats --lib passed: 27 passed, 4 ignored.
  • Used the actual DexNom XG module and texture crate in a Linux harness, with the registration types and three HRESULT constants supplied by the harness. Created a texture computer, then called the two copy methods through its vtable. On base, all eight invalid calls (two pitches × two layouts × both directions) returned S_OK and modified the destination. With the patch, all eight returned E_INVALIDARG and left the destination untouched. Six valid round trips, including the minimum pitch, padded pitch and single-slice mip, passed on both revisions.
  • The Windows GNU target passed cargo check --locked --target x86_64-pc-windows-gnu -p victory-hle -p victory-formats --tests. I have not run this DexNom revision on native Windows. No rendering or frame-rate claim.

AI-assisted port and testing.

**@⁠Yoshi-233** on GitHub · 2026-11-26 03:29 UTC · [original](https://github.com/DexNom/VIctory/pull/65) `Yoshi-233:fix/volume-copy-depth-pitch` → `main` · +47 −5 · 1 files · 1 commits · open A 2×2×2 R8 volume with two active bytes per row and a four-byte row pitch needs six bytes before the next depth slice may start. On `64bd58f`, pitches of 0 and 5 were accepted in both copy directions, allowing one slice to overwrite or reuse the previous slice’s texels. Check the occupied extent through the last active byte of a slice before copying. This preserves DexNom’s `bytes_from(mip)` limit for streamed mips. The next slice may start at byte 6; a single-slice mip still accepts a depth pitch of 0. This ports [Belobug/VIctory-Belobug-AMD#21](https://github.com/Belobug/VIctory-Belobug-AMD/pull/21), where I previously called the exported XG texture computer and its actual copy methods on native Windows build 26200. Those measurements exercise CPU-side layout and copy semantics. **Checks on DexNom** - Reproduced the new regression test on base (`Ok(())` for an overlapping pitch). After the fix, `cargo test --locked -p victory-formats --lib` passed: 27 passed, 4 ignored. - Used the actual DexNom XG module and texture crate in a Linux harness, with the registration types and three HRESULT constants supplied by the harness. Created a texture computer, then called the two copy methods through its vtable. On base, all eight invalid calls (two pitches × two layouts × both directions) returned `S_OK` and modified the destination. With the patch, all eight returned `E_INVALIDARG` and left the destination untouched. Six valid round trips, including the minimum pitch, padded pitch and single-slice mip, passed on both revisions. - The Windows GNU target passed `cargo check --locked --target x86_64-pc-windows-gnu -p victory-hle -p victory-formats --tests`. I have not run this DexNom revision on native Windows. No rendering or frame-rate claim. AI-assisted port and testing.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:33:06 +00:00
Author
Owner

@⁠Artking175 on GitHub · 2026-11-26 05:32 UTC · original

I ran cargo test --locked -p victory-formats --lib on native Windows 10 / MSVC, Rust 1.98.1, against 259756e. The volume depth-pitch regression passed and the full crate reported 27 passed, 0 failed, 4 ignored. This confirms the CPU-side copy test on native Windows. I did not exercise the exported XG vtable in this run.

**@⁠Artking175** on GitHub · 2026-11-26 05:32 UTC · [original](https://github.com/DexNom/VIctory/pull/65#issuecomment-7183578688) I ran `cargo test --locked -p victory-formats --lib` on native Windows 10 / MSVC, Rust 1.98.1, against `259756e`. The volume depth-pitch regression passed and the full crate reported 27 passed, 0 failed, 4 ignored. This confirms the CPU-side copy test on native Windows. I did not exercise the exported XG vtable in this run.
This pull request can be merged automatically.
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/65/head:github-bot/gh-65'
git switch 'github-bot/gh-65'

Merge

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