GPU: aliased textures copy only the subresources that have the same bytes per row #2274

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

@⁠denkencar-sketch on GitHub · 2026-11-25 09:28 UTC · original
denkencar-sketch:fix/tex-001 → main · +54 −13 · 1 files · 1 commits · open

Summary

Aliased textures were copied subresource by subresource when mips had the same footprint and rows but another row width, through a buffer sized for only one of them. common_subresources now keeps only the subresources with the same bytes per row.

Testing

Test aliased_subresources_need_the_same_bytes_per_row fails without the sa == sb row-pitch check and passes with this change; it covers the helper, not the alias_copy call site. cargo test --workspace --locked passes apart from the known flakes: modules::dstorage::tests::a_page_list_filled_after_its_request_starts fails now and then on main too, and so does a parallel-run flake in victory-gpu's lib tests (watch:: and descriptor::host:: tests, 2 of 40 runs on pristine main).

Not tried: a run in the game.

AI-assisted.

**@⁠denkencar-sketch** on GitHub · 2026-11-25 09:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2274) `denkencar-sketch:fix/tex-001` → `main` · +54 −13 · 1 files · 1 commits · open ## Summary Aliased textures were copied subresource by subresource when mips had the same footprint and rows but another row width, through a buffer sized for only one of them. `common_subresources` now keeps only the subresources with the same bytes per row. ## Testing Test `aliased_subresources_need_the_same_bytes_per_row` fails without the `sa == sb` row-pitch check and passes with this change; it covers the helper, not the `alias_copy` call site. `cargo test --workspace --locked` passes apart from the known flakes: `modules::dstorage::tests::a_page_list_filled_after_its_request_starts` fails now and then on `main` too, and so does a parallel-run flake in `victory-gpu`'s lib tests (`watch::` and `descriptor::host::` tests, 2 of 40 runs on pristine `main`). Not tried: a run in the game. AI-assisted.
Mips with the same footprint and rows but another row width were copied
through a buffer sized for one of them.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:00:40 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 13:32 UTC · original

Automated triage for the maintainers.

Worth a look: texture.rs alias_copy copies subresources in order while their offsets, row pitch, row count and depth match. It does not compare the row size in bytes, so a pair such as a 25x16 RGBA32 texture and a 100x64 BC7 texture (mip 1: 192 against 208 bytes a row) was copied out of a buffer sized from texture A's footprints with texture B's, reading past its end. The PR also takes GetCopyableFootprints' row sizes and stops at the first subresource where they differ (common_subresources); its unit test numbers check out. CI passes. It touches the same lines as #1888 (a larger rework of the same function, which does not add this check), so whichever lands second needs a rebase.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2274#issuecomment-7163913787) <!-- victory-triage v1 head=8a88297df004c98794ccfc548774af8a3b4761f4 verdict=merge-candidate at=2026-11-25T13:33:20Z --> Automated triage for the maintainers. Worth a look: `texture.rs` `alias_copy` copies subresources in order while their offsets, row pitch, row count and depth match. It does not compare the row size in bytes, so a pair such as a 25x16 RGBA32 texture and a 100x64 BC7 texture (mip 1: 192 against 208 bytes a row) was copied out of a buffer sized from texture A's footprints with texture B's, reading past its end. The PR also takes `GetCopyableFootprints`' row sizes and stops at the first subresource where they differ (`common_subresources`); its unit test numbers check out. CI passes. It touches the same lines as #1888 (a larger rework of the same function, which does not add this check), so whichever lands second needs a rebase. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:50 UTC · original

Code review and RTX 5090 + WARP verification at head 8a88297df004 merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/texture.rs:249-326):
    • common_subresources adds pRowSizeInBytes (sa[i] == sb[i]) alongside Offset, RowPitch, row count (ra[i] == rb[i]), and Depth from GetCopyableFootprints.
    • Fixes aliased BC/uncompressed pairs (such as 100x64 BC7 vs 25x16 RGBA32) where mip 0 matches but mip 1 shares RowPitch = 256 / rows = 8 / Offset = 8192 while differing in actual row byte width (208 B vs 192 B), ensuring the total-byte staging buffer allocated from fa strictly covers fb[0..n]. Stopping at the first mismatched subresource via take_while is conservative on multi-slice arrays but safe.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): 0 warnings
    • texture:: resource::tests: 21/21 passed on both RTX 5090 and WARP (--features diagnostics).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/2274#issuecomment-7179171187) Code review and RTX 5090 + WARP verification at head `8a88297df004` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/texture.rs:249-326`)**: - `common_subresources` adds `pRowSizeInBytes` (`sa[i] == sb[i]`) alongside `Offset`, `RowPitch`, row count (`ra[i] == rb[i]`), and `Depth` from `GetCopyableFootprints`. - Fixes aliased BC/uncompressed pairs (such as `100x64` BC7 vs `25x16` RGBA32) where mip 0 matches but mip 1 shares `RowPitch = 256` / `rows = 8` / `Offset = 8192` while differing in actual row byte width (`208` B vs `192` B), ensuring the `total`-byte staging buffer allocated from `fa` strictly covers `fb[0..n]`. Stopping at the first mismatched subresource via `take_while` is conservative on multi-slice arrays but safe. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): 0 warnings - `texture:: resource::tests`: **21/21 passed** on both RTX 5090 and WARP (`--features diagnostics`). LGTM.
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/2274/head:github-bot/gh-2274'
git switch 'github-bot/gh-2274'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2274'
git switch 'github-bot/gh-2274'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2274'
git switch 'github-bot/gh-2274'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2274'
git switch 'main'
git merge --squash 'github-bot/gh-2274'
git switch 'main'
git merge --ff-only 'github-bot/gh-2274'
git switch 'main'
git merge 'github-bot/gh-2274'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2274
No description provided.