GPU: aliased texture arrays with other mip counts are not copied subresource by subresource #2275

Closed
github-bot wants to merge 1 commit from gh-pr/2275/head into gh-pr/2275/base
Owner

@⁠denkencar-sketch on GitHub · 2026-11-25 09:29 UTC · original
denkencar-sketch:fix/tex-002 → main · +28 −0 · 1 files · 1 commits · closed without merging

Summary

Aliased texture arrays with other mip counts were copied subresource by subresource, but their subresource numbers name different mips and slices, so one slice's mip went into another slice. subresources_correspond now allows the per-subresource copy only when the mip counts match.

Testing

Test array_subresources_correspond_only_with_as_many_mips fails if subresources_correspond always returns true and passes with this change; it covers the helper, not the 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:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2275) `denkencar-sketch:fix/tex-002` → `main` · +28 −0 · 1 files · 1 commits · closed without merging ## Summary Aliased texture arrays with other mip counts were copied subresource by subresource, but their subresource numbers name different mips and slices, so one slice's mip went into another slice. `subresources_correspond` now allows the per-subresource copy only when the mip counts match. ## Testing Test `array_subresources_correspond_only_with_as_many_mips` fails if `subresources_correspond` always returns true and passes with this change; it covers the helper, not the 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.
Their subresource numbers name different mips and slices, so the copy
put one slice's mip into another slice.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:00:42 +00:00
github-bot closed this pull request 2026-11-26 05:00:42 +00:00
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 09:55 UTC · original

Tested #2275 (b6a9ebe) together with #2274 (8a88297) on Windows. Both changes share base 940d32f. The two textual conflicts are at helper/test insertion points; keeping both helpers and both tests compiled. The call-site edits combined automatically.

I supplied synthetic RGBA32F and BC7 descriptions to D3D12 GetCopyableFootprints and checked the resulting prefix in both directions:

  • Two slices, two mips each: 24×16 RGBA32F vs 96×64 BC7 retained all four subresources. At 25×16 vs 100×64, the second mip had 192 vs 208 bytes per row. Omitting just the row-size comparison admitted four; including it retained one.
  • At width 24 with two mips vs one, the footprint prefix alone was one. With two slices the mip-count guard rejected the pair; with one slice it retained the common first mip.

All three selected tests passed. This checks the native layout metadata and both selection rules. GPU copy execution and resulting texels were outside this run. AI-assisted, synthetic descriptors only.

**@⁠Dathinel** on GitHub · 2026-11-25 09:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2275#issuecomment-7158987737) Tested #2275 (b6a9ebe) together with #2274 (8a88297) on Windows. Both changes share base 940d32f. The two textual conflicts are at helper/test insertion points; keeping both helpers and both tests compiled. The call-site edits combined automatically. I supplied synthetic RGBA32F and BC7 descriptions to D3D12 GetCopyableFootprints and checked the resulting prefix in both directions: - Two slices, two mips each: 24×16 RGBA32F vs 96×64 BC7 retained all four subresources. At 25×16 vs 100×64, the second mip had 192 vs 208 bytes per row. Omitting just the row-size comparison admitted four; including it retained one. - At width 24 with two mips vs one, the footprint prefix alone was one. With two slices the mip-count guard rejected the pair; with one slice it retained the common first mip. All three selected tests passed. This checks the native layout metadata and both selection rules. GPU copy execution and resulting texels were outside this run. AI-assisted, synthetic descriptors only.
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 10:51 UTC · original

I added a WARP readback regression on top of your exact head b6a9ebe00182abf29a77aaf8097d4412b4e355c6. Test commit b9020a9.

The source is a two-slice, one-mip R32G32_UINT texture with two synthetic BC1 blocks. The destination is a two-slice, two-mip BC1 texture at the same title address, initialized to blue. The fixture resolves the alias through alias_source, records alias_copy, submits the list and reads the packed destination blocks back.

  • On 940d32f with the same test, array slice 1 overwrites mip 1 of destination slice 0 with the green block 0x07e0.
  • On b6a9ebe, the tested mip retains its original blue block 0x001f. Full forced-WARP GPU library suite gives 148 passed, 2 ignored. GPU Clippy in both feature modes and repository policy passed.

Please preserve the Git author if you cherry-pick this test. If you fold it into another commit, please add:

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted. Synthetic tests only.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 10:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2275#issuecomment-7160275224) I added a WARP readback regression on top of your exact head `b6a9ebe00182abf29a77aaf8097d4412b4e355c6`. [Test commit `b9020a9`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/b9020a9e8b5689d2c28a79cd6d0b4d466e1c045c). The source is a two-slice, one-mip R32G32_UINT texture with two synthetic BC1 blocks. The destination is a two-slice, two-mip BC1 texture at the same title address, initialized to blue. The fixture resolves the alias through `alias_source`, records `alias_copy`, submits the list and reads the packed destination blocks back. - On `940d32f` with the same test, array slice 1 overwrites mip 1 of destination slice 0 with the green block `0x07e0`. - On `b6a9ebe`, the tested mip retains its original blue block `0x001f`. Full forced-WARP GPU library suite gives 148 passed, 2 ignored. GPU Clippy in both feature modes and repository policy passed. Please preserve the Git author if you cherry-pick this test. If you fold it into another commit, please add: Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted. Synthetic tests only.
Author
Owner

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

Automated triage for the maintainers.

Merge candidate (worth a look). texture::alias_copy copied aliased textures by subresource index; for arrays whose mip counts differ, index i names a different mip/slice in each (D3D12 numbers subresources mip-major within a slice), and the footprint comparison on main does not always catch that. The new subresources_correspond skips such pairs (with a once! log), which leaves the destination stale instead of writing a slice into another slice's mip; a tester reproduced the wrong copy on main on WARP and its absence with this head. CI check passes and it merges cleanly. Note: #2274 edits the same function and the two conflict textually (a tester merged both by hand); copying the common mips slice by slice could be a later improvement over skipping.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 13:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2275#issuecomment-7163935099) <!-- victory-triage v1 head=b6a9ebe00182abf29a77aaf8097d4412b4e355c6 verdict=merge-candidate at=2026-11-25T13:48:00Z --> Automated triage for the maintainers. **Merge candidate (worth a look).** `texture::alias_copy` copied aliased textures by subresource index; for arrays whose mip counts differ, index `i` names a different mip/slice in each (D3D12 numbers subresources mip-major within a slice), and the footprint comparison on `main` does not always catch that. The new `subresources_correspond` skips such pairs (with a `once!` log), which leaves the destination stale instead of writing a slice into another slice's mip; a tester reproduced the wrong copy on `main` on WARP and its absence with this head. CI `check` passes and it merges cleanly. Note: #2274 edits the same function and the two conflict textually (a tester merged both by hand); copying the common mips slice by slice could be a later improvement over skipping. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:07 UTC · original

Automated triage for the maintainers, second look (a review against current main, with builds and tests where they could change the verdict).

Closing because the fix is worse than main where it applies. It returns before copying anything, so subresource 0 and the first slice's common mips, which do correspond, are no longer copied, and host_writes is not called, so the destination falls back to stale title memory. The helper also tests only the source's array size. The problem is real in principle; copying by (mip, slice) for the mips below the smaller count would be the right change.

If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 22:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2275#issuecomment-7175972897) Automated triage for the maintainers, second look (a review against current `main`, with builds and tests where they could change the verdict). Closing because the fix is worse than `main` where it applies. It returns before copying anything, so subresource 0 and the first slice's common mips, which do correspond, are no longer copied, and `host_writes` is not called, so the destination falls back to stale title memory. The helper also tests only the source's array size. The problem is real in principle; copying by (mip, slice) for the mips below the smaller count would be the right change. If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.

Pull request closed

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!2275
No description provided.