GPU diagnostics: count texture data without row padding #2526

Open
andrewpozdnakov7-jpg wants to merge 3 commits from upstream-pr/2528 into main
andrewpozdnakov7-jpg commented 2026-11-25 15:21:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T15:21:02Z.


The diagnostic probe reads the first slice of a 1D or 3D UAV texture after a dispatch. Its dword count and sample values came from pitched rows, so padding changed the denominator and could appear in the sample.

Count the unpadded bytes of each row and stop the mapped span at the last texel. A final partial dword is zero-extended. D3D12 footprint row size and pitch

The same synthetic test uses a 2 × 2 R32 layout with 256-byte row pitch, three nonzero values, and sentinel bytes in the padding. The original counting logic from 67e8ae1401 reports 127 of 128 dwords set. ca477f2 reports 3 of 4 and returns all four texels in order. It also passes the unpadded final-row and partial-dword cases.

Windows/WARP serial GPU suite passed with 199 passed and 1 ignored under both D3D12 debug flag settings. Strict GPU Clippy in both modes and the asset policy passed. AI-assisted. The change affects diagnostic statistics.

Coordination claim

Please preserve the Git author when reapplying the change. If you fold the code or test into another commit, please add this trailer.

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

<!-- greyfinch-sync:Marvisak/VIctory:issue:5494167453 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2528). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T15:21:02Z. --- The diagnostic probe reads the first slice of a 1D or 3D UAV texture after a dispatch. Its dword count and sample values came from pitched rows, so padding changed the denominator and could appear in the sample. Count the unpadded bytes of each row and stop the mapped span at the last texel. A final partial dword is zero-extended. [D3D12 footprint row size and pitch](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-getcopyablefootprints) The same synthetic test uses a 2 × 2 R32 layout with 256-byte row pitch, three nonzero values, and sentinel bytes in the padding. The original counting logic from 67e8ae1401df112248aed36d0024483181b718b7 reports 127 of 128 dwords set. ca477f2 reports 3 of 4 and returns all four texels in order. It also passes the unpadded final-row and partial-dword cases. Windows/WARP serial GPU suite passed with 199 passed and 1 ignored under both D3D12 debug flag settings. Strict GPU Clippy in both modes and the asset policy passed. AI-assisted. The change affects diagnostic statistics. [Coordination claim](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7166460209) Please preserve the Git author when reapplying the change. If you fold the code or test into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
Marvisak commented 2026-11-25 17:05:01 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T16:15:02Z.


Automated triage for the maintainers.

Merge candidate. Re-reviewed after the rebase (0e48cc8, merges cleanly into current main). The diagnostics probe for 1D/3D UAV textures after a dispatch (State::probe_written in crates/victory-gpu/src/draw.rs) now reads from the footprint's offset and stops at the last texel. written_texture_words counts only each row's unpadded bytes and zero-extends a final partial dword, so row padding no longer inflates the dword count or appears in the sample. The span length (rows - 1) * pitch + row_bytes is bounded by the readback footprint, and element handles block-compressed rows. The change is diagnostics-only (behind feature = "diagnostics"), and the unit test covers padded rows, an unpadded final row and a partial dword. CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7167723670 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7167723670). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T16:15:02Z. --- <!-- victory-triage v1 head=0e48cc8cf3a372986c74e6c25263d4470f49aabe verdict=merge-candidate at=2026-11-26T00:24:00Z --> Automated triage for the maintainers. **Merge candidate.** Re-reviewed after the rebase (`0e48cc8`, merges cleanly into current `main`). The diagnostics probe for 1D/3D UAV textures after a dispatch (`State::probe_written` in `crates/victory-gpu/src/draw.rs`) now reads from the footprint's offset and stops at the last texel. `written_texture_words` counts only each row's unpadded bytes and zero-extends a final partial dword, so row padding no longer inflates the dword count or appears in the sample. The span length `(rows - 1) * pitch + row_bytes` is bounded by the readback footprint, and `element` handles block-compressed rows. The change is diagnostics-only (behind `feature = "diagnostics"`), and the unit test covers padded rows, an unpadded final row and a partial dword. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
andrewpozdnakov7-jpg commented 2026-11-25 17:05:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T16:45:59Z.


Updated the branch for 67e8ae1401. The same native Windows test gets 127 of 128 nonzero dwords from the old counting logic and 3 of 4 after the patch. The test checks all four texels, the unpadded final row and a partial dword. Serial Windows/WARP GPU suite 199 passed and 1 ignored in both debug flag settings. Strict GPU Clippy in both modes and policy passed.

Updated commit

If you fold the change or test into another commit, please preserve the Git author or add this trailer.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7168498216 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7168498216). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T16:45:59Z. --- Updated the branch for 67e8ae1401df112248aed36d0024483181b718b7. The same native Windows test gets 127 of 128 nonzero dwords from the old counting logic and 3 of 4 after the patch. The test checks all four texels, the unpadded final row and a partial dword. Serial Windows/WARP GPU suite 199 passed and 1 ignored in both debug flag settings. Strict GPU Clippy in both modes and policy passed. [Updated commit](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/ca477f2e1fdd57cedc53bf70ca1c174057393fc6) If you fold the change or test into another commit, please preserve the Git author or add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
andrewpozdnakov7-jpg commented 2026-11-25 23:06:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T22:28:39Z.


I resolved the test-module conflict with #1778 and kept both fixtures in 0e48cc8.

The same synthetic 256-byte-pitch fixture run with the unchanged counting logic in f3578e3 counts 127 of 128 dwords set. The update counts 3 of 4 without including row padding, preserves the four sample values, and passes the short final-row and partial-dword controls. The upstream sampler-heap test also passes.

Both serial Windows/WARP GPU suites passed with 244 tests and one ignored. GPU Clippy with and without diagnostics and asset policy passed.

Please retain the Git author when carrying the fix or tests. If folded into another commit, please add this trailer.

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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7176409901 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7176409901). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T22:28:39Z. --- I resolved the test-module conflict with #1778 and kept both fixtures in [0e48cc8](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/0e48cc8cf3a372986c74e6c25263d4470f49aabe). The same synthetic 256-byte-pitch fixture run with the unchanged counting logic in `f3578e3` counts 127 of 128 dwords set. The update counts 3 of 4 without including row padding, preserves the four sample values, and passes the short final-row and partial-dword controls. The upstream sampler-heap test also passes. Both serial Windows/WARP GPU suites passed with 244 tests and one ignored. GPU Clippy with and without diagnostics and asset policy passed. Please retain the Git author when carrying the fix or tests. If folded into another commit, please add this trailer. Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
fuzeofficlal commented 2026-11-26 01:04:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:35:59Z.


Code review and hardware + WARP verification at head 0e48cc8cf3a3 merged cleanly onto main (63bcca43c6a0):

  • Code review: Scoped cleanly to #[cfg(feature = "diagnostics")] probe_written in crates/victory-gpu/src/draw.rs. Computing rows = Height.div_ceil(block) and row_bytes = Width.div_ceil(block) * element via resource::element handles both 4x4 block-compressed and uncompressed formats, and sizing the mapped slice to (rows - 1) * pitch + row_bytes removes 256-byte row-pitch padding noise and avoids reading past the end of subresource 0's readback buffer. written_texture_words slices each row to row[..row_bytes], zero-pads partial trailing <4-byte rows without bleeding across rows, and safely returns None for formats not covered by resource::element.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok
    • cargo clippy --locked -p victory-gpu --tests -- -D warnings (default + --features diagnostics): 0 warnings
    • Default draw::tests (VICTORY_D3D12_DEBUG=1): 20/20 passed
    • RTX 5090 (--features diagnostics, VICTORY_D3D12_DEBUG=1, draw::tests): 21/21 passed (including written_texture_probe_counts_texels_without_row_padding)
    • WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1, draw::tests): 21/21 passed

Looks clean and ready to merge.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7178923063 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7178923063). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T00:35:59Z. --- Code review and hardware + WARP verification at head `0e48cc8cf3a3` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review**: Scoped cleanly to `#[cfg(feature = "diagnostics")]` `probe_written` in `crates/victory-gpu/src/draw.rs`. Computing `rows = Height.div_ceil(block)` and `row_bytes = Width.div_ceil(block) * element` via `resource::element` handles both 4x4 block-compressed and uncompressed formats, and sizing the mapped slice to `(rows - 1) * pitch + row_bytes` removes 256-byte row-pitch padding noise and avoids reading past the end of subresource 0's readback buffer. `written_texture_words` slices each row to `row[..row_bytes]`, zero-pads partial trailing `<4`-byte rows without bleeding across rows, and safely returns `None` for formats not covered by `resource::element`. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok` - `cargo clippy --locked -p victory-gpu --tests -- -D warnings` (default + `--features diagnostics`): 0 warnings - Default `draw::tests` (`VICTORY_D3D12_DEBUG=1`): 20/20 passed - RTX 5090 (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, `draw::tests`): 21/21 passed (including `written_texture_probe_counts_texels_without_row_padding`) - WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`, `draw::tests`): 21/21 passed Looks clean and ready to merge.
cloph-dsp commented 2026-11-27 08:21:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T08:21:35Z.


Independent CPU-only verification of PR #2528 (GPU diagnostics texture padding).

  • Windows, rustc/cargo 1.100.0/MSVC, worktree-local CARGO_TARGET_DIR (D:\Victory-Contrib\target-2528-verify), CARGO_BUILD_JOBS=2.
  • Head 0e48cc8cf3a372986c74e6c25263d4470f49aabe, merge base f3578e38.
  • Command: cargo test --locked -p victory-gpu --lib --features diagnostics -- draw::tests::written_texture_probe_counts_texels_without_row_padding --exact --test-threads=1 --quiet -> 1 passed; 0 failed; 0 ignored; 0 measured; 244 filtered out, exit 0.
  • Negative control: git grep -F for the new test name on base f3578e3 returned no hits (test absent on base).
  • git diff --check f3578e3 HEAD exit 0 (clean).
  • Only the named synthetic test was replayed; full suite and real GPU capture paths were not exercised. --features diagnostics is required because the test is gated by #[cfg(feature = "diagnostics")].
  • AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only test with fake device). No game data, assets, shaders, DRM or decrypt used.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7213450741 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2528#issuecomment-7213450741). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T08:21:35Z. --- Independent CPU-only verification of PR #2528 (GPU diagnostics texture padding). - Windows, rustc/cargo 1.100.0/MSVC, worktree-local `CARGO_TARGET_DIR` (`D:\Victory-Contrib\target-2528-verify`), `CARGO_BUILD_JOBS=2`. - Head `0e48cc8cf3a372986c74e6c25263d4470f49aabe`, merge base `f3578e38`. - Command: `cargo test --locked -p victory-gpu --lib --features diagnostics -- draw::tests::written_texture_probe_counts_texels_without_row_padding --exact --test-threads=1 --quiet` -> `1 passed; 0 failed; 0 ignored; 0 measured; 244 filtered out`, exit 0. - Negative control: `git grep -F` for the new test name on base `f3578e3` returned no hits (test absent on base). - `git diff --check f3578e3 HEAD` exit 0 (clean). - Only the named synthetic test was replayed; full suite and real GPU capture paths were not exercised. `--features diagnostics` is required because the test is gated by `#[cfg(feature = "diagnostics")]`. - AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only test with fake device). No game data, assets, shaders, DRM or decrypt used.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2528:upstream-pr/2528'
git switch 'upstream-pr/2528'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2528'
git switch 'upstream-pr/2528'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2528'
git switch 'upstream-pr/2528'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2528'
git switch 'main'
git merge --squash 'upstream-pr/2528'
git switch 'main'
git merge --ff-only 'upstream-pr/2528'
git switch 'main'
git merge 'upstream-pr/2528'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2526
No description provided.