GPU: require texture copy footprints to fit a complete row #3032
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3034"
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 andrewpozdnakov7-jpg on 2026-11-26T04:12:11Z.
CopyTextureRegionusesPlacedFootprintto size upload staging and to read back the requested rows. Each calculation now checks that the full unpadded row fits withinRowPitch. For block compression, the row size is the number of horizontal blocks times the bytes per block.The same synthetic footprint test on
63bcca4accepts an undersized pitch for both RGBA8 and BC1 through both calculations. This revision rejects both, including a small region within the incomplete footprint. Exact-fit and padded pitches still return the expected row offsets and final byte count. The regression tests the layout calculations directly.Valid guest upload and readback tests and the full Agility WARP GPU suite passed (247 passed, one ignored). The diff applies cleanly beside either #3006 or #3022. Strict GPU Clippy with and without diagnostics and the repository asset policy passed. This follows the optional row-width notes in #3006 and #3022. D3D12_SUBRESOURCE_FOOTPRINT Coordination claim
AI-assisted with Codex. Synthetic inputs.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T04:15:03Z.
Review: APPROVED
Looks clean and minimal on
374aaded.PlacedFootprint::row_layoutcomputesu64::from(self.width).div_ceil(block) * element(overflow-free for allu32widths) and rejects footprints whoserow_pitchis smaller than an unpadded row.row_layout()betweenbytes()androws()ensures both upload (list.rs:726) and readback (list.rs:853) cleanly reject short-pitch footprints rather than returning overlapping per-row byte ranges or undersized spans.R8G8B8A8, format 28) and block-compressed (BC1, format 71) formats across valid, undersized, and exact-fit row pitches.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T04:36:43Z.
Review: APPROVED
LGTM — row_layout centralizes the row-fits-pitch requirement for both bytes() and rows(); the test hits the boundary exactly (row 260/264 at pitch 256 refused; width-1 → exactly 256 accepted). Format arithmetic checks out (28=RGBA8→260, 71=BC→264).
Imported from Marvisak/VIctory. Originally posted by pawrenity on 2026-11-26T05:04:09Z.
VERIFY-3034: verified
374aadeon NVIDIA GeForce RTX 4070, Windows 11 (MSVC). No defects found.a_placed_footprint_pitch_covers_a_complete_row, with only the test hunk applied to origin/main63bcca4, fails withaccepted short row pitches: [(28, true, true), (71, true, true)](both RGBA8 and BC1 accepted throughbytes()androws()). It passes at head.cargo test -p victory-gpu --libat head: 230 passed, 1 ignored, 2 failed. The two failures aredynamic_slots_are_held_until_releasedandlists_share_a_table_and_copies_keep_their_views, which also fail on main on this card (capped view heap). The existing footprint, upload and readback tests inresource::testsall pass.cargo clippy -p victory-gpu --all-targets -- -D warningsis clean, with and without--features diagnostics.63bcca4is clean.Review (reading only): the row size
ceil(width / block) * elementmatches D3D12_SUBRESOURCE_FOOTPRINT (RowPitch must hold at least one full row; BC rows are counted in 4x4 blocks). The test values check out: 65 RGBA8 texels are 260 bytes, 129 BC1 texels are 33 blocks of 8 = 264 bytes, and one texel fewer gives exactly 256. Buffer footprints (format 0) and the internally generatedcopyable_footprintslayouts never fall below the row size, so they are unaffected. When a pitch is too short, the upload path (list.rs~726) returns without recording, as it already does for an unsized format. The readback path (list.rs~853) reports it asrefused!("a region outside its footprint"), so the log reason is slightly loose for this case but the behaviour is correct.AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T06:48:58Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):row <= row_pitchinsidePlacedFootprint::row_layout()cleanly rejects malformed copy footprints whose row pitch cannot hold a complete unpadded row in bothbytes()androws().cargo test -p victory-gpu resource::tests -- --test-threads=1: 19 passed, 0 failed (includinga_placed_footprint_pitch_covers_a_complete_row).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:18:18Z.
Automated triage for the maintainers.
PlacedFootprint::bytesandrows(crates/victory-gpu/src/resource.rs) now returnNonewhenRowPitchis shorter than one unpadded row (ceil(width / block) * element). BothCopyTextureRegionpaths inlist.rspass the title's footprint to the host with only its offset changed. Without this check, a too-short pitch reaches host D3D12, which requiresRowPitchto hold a full row (publicD3D12_SUBRESOURCE_FOOTPRINTdocs). With it, the upload path skips the copy and the readback path refuses it, as both already do for unsized formats.mainalready checks the 256-byte pitch alignment, so this completes the validation. Unsized formats (elementreturnsNone) behave as before. I checked the test values: 65 RGBA8 texels = 260 bytes, and 129 BC1 texels = 33 blocks of 8 bytes = 264. The change is defensive, since a well-formed title call never hits it, but it is small and keeps an invalid call away from the host driver. It sits beside #3006 and #3022 in the same file, and the author says it applies cleanly with either.CI:
checkpassing.Generated by Claude Code
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.