GPU: aliased textures copy only the subresources that have the same bytes per row #2272
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2274"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by denkencar-sketch on 2026-11-25T09:28:59Z.
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_subresourcesnow keeps only the subresources with the same bytes per row.Testing
Test
aliased_subresources_need_the_same_bytes_per_rowfails without thesa == sbrow-pitch check and passes with this change; it covers the helper, not thealias_copycall site.cargo test --workspace --lockedpasses apart from the known flakes:modules::dstorage::tests::a_page_list_filled_after_its_request_startsfails now and then onmaintoo, and so does a parallel-run flake invictory-gpu's lib tests (watch::anddescriptor::host::tests, 2 of 40 runs on pristinemain).Not tried: a run in the game.
AI-assisted.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T09:35:42Z.
Review: COMMENTED
Aliased textures copy only the subresources that have the same footprint (common_subresources prefix match). Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. Cluster with #2275 (both touch alias_copy in texture.rs).
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T10:04:01Z.
Review: APPROVED
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:pRowSizeInBytesfromGetCopyableFootprintsand checkingsa[i] == sb[i]incommon_subresourcescleanly prevents copying aliased subresources whose row pitch matches but whose per-row byte count differs.cargo test -p victory-gpu texture::: 3/3 passed on RTX 5090, 3/3 passed on WARP (includingaliased_subresources_need_the_same_bytes_per_row).cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T13:32:01Z.
Automated triage for the maintainers.
Worth a look:
texture.rsalias_copycopies 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 takesGetCopyableFootprints' 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
upstream-sync referenced this pull request2026-11-25 14:07:24 +00:00
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:50:46Z.
Code review and RTX 5090 + WARP verification at head
8a88297df004merged cleanly ontomain(63bcca43c6a0):crates/victory-gpu/src/texture.rs:249-326):common_subresourcesaddspRowSizeInBytes(sa[i] == sb[i]) alongsideOffset,RowPitch, row count (ra[i] == rb[i]), andDepthfromGetCopyableFootprints.100x64BC7 vs25x16RGBA32) where mip 0 matches but mip 1 sharesRowPitch = 256/rows = 8/Offset = 8192while differing in actual row byte width (208B vs192B), ensuring thetotal-byte staging buffer allocated fromfastrictly coversfb[0..n]. Stopping at the first mismatched subresource viatake_whileis conservative on multi-slice arrays but safe.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 warningstexture:: resource::tests: 21/21 passed on both RTX 5090 and WARP (--features diagnostics).LGTM.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.