GPU: return NV12 and P010 luma and chroma copy footprints #1982

Open
yuniskh wants to merge 2 commits from upstream-pr/1984 into main
yuniskh commented 2026-11-25 02:19:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by yuniskh on 2026-11-25T02:19:36Z.


On ccfb029, GetCopyableFootprints returned zero widths and heights for a valid two-slice NV12 array. This change returns full-size luma footprints and chroma footprints at half the width and height for NV12 and P010. It uses each plane’s native copy format and aligns row pitches to 512 bytes. The regression checks the plane order for two array slices and a query starting at the first chroma slice.

Original hardware testing and measurements by YUNISKH (@yuniskh). On my RTX 5090 and integrated AMD Radeon, VIctory matched native D3D12 on all 1,224 queries and all 2,880 plane entries per GPU. I tested six image sizes from 2×2 to 3840×2160, one to three array slices, and base offsets of 0, 512 and 4096 bytes.

The focused regression failed on ccfb029 and passed on this branch. The WARP diagnostics suite passed 145 tests with 2 ignored. On default hardware, 140 passed, 2 failed and 2 were ignored. Both failing descriptor-heap tests also failed on the baseline. Clippy passed for victory-gpu with default and all features, and the asset-policy check passed.

This builds on @broccolize’s depth/stencil work in #504. @ToxicmaggotRP’s #409 covers unaligned base offsets. I used Codex to prepare and verify the change.

Original measurements · Test logs and reproduction steps

<!-- greyfinch-sync:Marvisak/VIctory:issue:5483885925 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1984). Originally posted by [yuniskh](https://github.com/yuniskh) on 2026-11-25T02:19:36Z. --- On `ccfb029`, `GetCopyableFootprints` returned zero widths and heights for a valid two-slice NV12 array. This change returns full-size luma footprints and chroma footprints at half the width and height for NV12 and P010. It uses each plane’s native copy format and aligns row pitches to 512 bytes. The regression checks the plane order for two array slices and a query starting at the first chroma slice. **Original hardware testing and measurements by YUNISKH (@yuniskh).** On my RTX 5090 and integrated AMD Radeon, VIctory matched native D3D12 on all 1,224 queries and all 2,880 plane entries per GPU. I tested six image sizes from 2×2 to 3840×2160, one to three array slices, and base offsets of 0, 512 and 4096 bytes. The focused regression failed on `ccfb029` and passed on this branch. The WARP diagnostics suite passed 145 tests with 2 ignored. On default hardware, 140 passed, 2 failed and 2 were ignored. Both failing descriptor-heap tests also failed on the baseline. Clippy passed for `victory-gpu` with default and all features, and the asset-policy check passed. This builds on @broccolize’s depth/stencil work in #504. @ToxicmaggotRP’s #409 covers unaligned base offsets. I used Codex to prepare and verify the change. [Original measurements](https://github.com/Marvisak/VIctory/issues/386#issuecomment-7120877314) · [Test logs and reproduction steps](https://github.com/yuniskh/VIctory/blob/34194a0fa82084391f55689746e26db67f0f5387/reports/2026-11-24/gpu-verification/README.md#nv12-and-p010-footprints)
catminou4 commented 2026-11-25 02:48:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:48:40Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

NV12/P010 luma+chroma copy footprints — YUV copy path completeness; pairs with #1954's texture-to-buffer copies.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051087124 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1984#pullrequestreview-6051087124). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T02:48:40Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. NV12/P010 luma+chroma copy footprints — YUV copy path completeness; pairs with #1954's texture-to-buffer copies.
DesertGamer commented 2026-11-25 03:03:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-25T02:28:01Z.


VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150759632 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1984#issuecomment-7150759632). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-25T02:28:01Z. --- ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Marvisak commented 2026-11-25 09:06:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T08:26:47Z.


Automated triage for the maintainers.

Merge candidate.

resource::subresource in crates/victory-gpu/src/resource.rs now gives NV12 (103) and P010 (104) two planes. Each plane gets its own copy format: R8 and R8G8 for NV12, R16 and R16G16 for P010. The chroma plane is half size, and row pitches are 512-aligned. Descriptions that are not valid for these formats get None: not 2D, more than one mip, MSAA, or odd sizes.

On main, element() has no entry for 103/104, so these queries returned NO_FOOTPRINT and an all-ones total. I checked the following:

  • Plane order: all Y slices come before all UV slices (plane = index / mips / slices), the same convention as the existing depth/stencil path.
  • Byte sizes: the element sizes of the new copy formats match element().
  • Test arithmetic: the expected offsets and totals in the test follow from copyable_footprints' 512-byte placement.

The evidence is a comparison against native D3D12 on NVIDIA and AMD hardware, with sizes, slices and base offsets varied. That follows the reference main already uses for depth/stencil.

Note for the maintainer: nothing else on main handles NV12/P010 yet, so it is not shown that the title makes this query. The change is self-contained and does not affect other formats.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7157034430 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1984#issuecomment-7157034430). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T08:26:47Z. --- <!-- victory-triage v1 head=0477a4b6472e93d932d9bf21a91c3b6c0920c6a2 verdict=merge-candidate at=2026-11-25T08:26:37Z --> Automated triage for the maintainers. **Merge candidate.** `resource::subresource` in `crates/victory-gpu/src/resource.rs` now gives NV12 (103) and P010 (104) two planes. Each plane gets its own copy format: R8 and R8G8 for NV12, R16 and R16G16 for P010. The chroma plane is half size, and row pitches are 512-aligned. Descriptions that are not valid for these formats get `None`: not 2D, more than one mip, MSAA, or odd sizes. On `main`, `element()` has no entry for 103/104, so these queries returned `NO_FOOTPRINT` and an all-ones total. I checked the following: - **Plane order:** all Y slices come before all UV slices (`plane = index / mips / slices`), the same convention as the existing depth/stencil path. - **Byte sizes:** the element sizes of the new copy formats match `element()`. - **Test arithmetic:** the expected offsets and totals in the test follow from `copyable_footprints`' 512-byte placement. The evidence is a comparison against native D3D12 on NVIDIA and AMD hardware, with sizes, slices and base offsets varied. That follows the reference `main` already uses for depth/stencil. Note for the maintainer: nothing else on `main` handles NV12/P010 yet, so it is not shown that the title makes this query. The change is self-contained and does not affect other formats. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
fuzeofficlal commented 2026-11-26 02:07:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:37:16Z.


Code review and live RTX 5090 + WARP native GetCopyableFootprints parity verification at head 0477a4b6472e merged cleanly onto main (63bcca43c6a0):

  • Code & native D3D12 parity check (crates/victory-gpu/src/resource.rs:373-440):
    • Enforces TEXTURE_2D, mip_levels == 1, sample_count == 1, depth_or_array_size in 1..=2048, and even dimensions >= 2 for NV12 (103) and P010 (104) so plane 1's extent_shift = 1 halves cleanly.
    • Cross-checked directly against live ID3D12Device::GetCopyableFootprints on both NVIDIA RTX 5090 and WARP (514x258, array_size = 2, base = 512): native D3D12 uses 512-byte row pitch alignment and 512-byte offset alignment for both planar video formats, matching #1984 field-for-field with 0 differences:
      • NV12 (103): total = 792066, offsets [512, 264704, 528896, 660992], RowPitch = 1024, rows [258, 258, 129, 129], row sizes [514, 514, 514, 514]
      • P010 (104): total = 1188356, offsets [512, 396800, 793088, 991232], RowPitch = 1536, rows [258, 258, 129, 129], row sizes [1028, 1028, 1028, 1028].
  • 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: 0 warnings
    • victory-gpu -- resource::: 19/19 passed on both RTX 5090 and WARP (including planar_video_copy_footprints).

Exact match with native D3D12 on both backends; LGTM.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179956045 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1984#issuecomment-7179956045). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:37:16Z. --- Code review and live RTX 5090 + WARP native `GetCopyableFootprints` parity verification at head `0477a4b6472e` merged cleanly onto `main` (`63bcca43c6a0`): - **Code & native D3D12 parity check (`crates/victory-gpu/src/resource.rs:373-440`)**: - Enforces `TEXTURE_2D`, `mip_levels == 1`, `sample_count == 1`, `depth_or_array_size in 1..=2048`, and even dimensions `>= 2` for `NV12` (`103`) and `P010` (`104`) so plane 1's `extent_shift = 1` halves cleanly. - Cross-checked directly against live `ID3D12Device::GetCopyableFootprints` on both **NVIDIA RTX 5090** and **WARP** (`514x258`, `array_size = 2`, `base = 512`): native D3D12 uses 512-byte row pitch alignment and 512-byte offset alignment for both planar video formats, matching `#1984` field-for-field with **0 differences**: - `NV12 (103)`: `total = 792066`, offsets `[512, 264704, 528896, 660992]`, `RowPitch = 1024`, rows `[258, 258, 129, 129]`, row sizes `[514, 514, 514, 514]` - `P010 (104)`: `total = 1188356`, offsets `[512, 396800, 793088, 991232]`, `RowPitch = 1536`, rows `[258, 258, 129, 129]`, row sizes `[1028, 1028, 1028, 1028]`. - **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`: 0 warnings - `victory-gpu -- resource::`: **19/19 passed** on both RTX 5090 and WARP (including `planar_video_copy_footprints`). Exact match with native D3D12 on both backends; LGTM.
fuzeofficlal commented 2026-11-26 13:09:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T13:09:28Z.

Review: APPROVED


Reviewed and verified 0477a4b6 merged locally onto origin/main (63bcca43) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust 1.98.1 MSVC, Windows SDK 10.0.26100.0 dxil.dll; synthetic tests only, no game files).

Verification

  • git merge-tree against origin/main (63bcca43): clean.
  • cargo xtask policy (PR head): 182 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features, PR head and merged): 0 warnings.
  • RTX 5090 & WARP (VICTORY_D3D12_DEBUG=1, --features diagnostics): resource::tests — 19 passed, 0 failed on both adapters (including planar_video_copy_footprints).
  • Live native ID3D12Device::GetCopyableFootprints differential parity matrix (RTX 5090 and WARP):
    • Compared VIctory's copyable_footprints against live native ID3D12Device::GetCopyableFootprints across NV12 (103) and P010 (104) x 8 sizes (2x2, 4x4, 64x64, 130x66, 256x128, 514x258, 1920x1080, 3840x2160) x 1-3 array slices x every valid (first, count) subrange x base offsets 0, 512, 4096:
      • RTX 5090: 1,632 queries / 3,840 plane entries — 0 mismatches across Offset, Format, Width, Height, Depth, RowPitch, NumRows, RowSizeInBytes, and TotalBytes.
      • WARP: 1,632 queries / 3,840 plane entries — 0 mismatches.
    • Invalid descriptors (odd_w, odd_h, mip_levels = 0, mip_levels = 2, sample_count = 4) for both 103 and 104: 10/10 matched native u64::MAX (0xffffffffffffffff) on both RTX 5090 and WARP.

Review Notes

  • Descriptor validation (crates/victory-gpu/src/resource.rs:349-362) enforces 2D, single mip, single sample, valid array slice count (1..=2048), and even dimensions >= 2 before applying the plane 0/1 copy formats (R8/R8G8 for NV12, R16/R16G16 for P010), 512-byte row-pitch alignment, and half-extent shift (crates/victory-gpu/src/resource.rs:383-395).
  • Self-contained and matches native D3D12 field-for-field on both hardware and software backends.

Looks good to merge.

<!-- greyfinch-sync:Marvisak/VIctory:review:6074679175 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1984#pullrequestreview-6074679175). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T13:09:28Z. **Review:** APPROVED --- Reviewed and verified `0477a4b6` merged locally onto `origin/main` (`63bcca43`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 and WARP, Rust `1.98.1` MSVC, Windows SDK `10.0.26100.0` `dxil.dll`; synthetic tests only, no game files). ### Verification - `git merge-tree` against `origin/main` (`63bcca43`): clean. - `cargo xtask policy` (PR head): `182 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`, PR head and merged): 0 warnings. - **RTX 5090 & WARP (`VICTORY_D3D12_DEBUG=1`, `--features diagnostics`):** `resource::tests` — **19 passed, 0 failed** on both adapters (including `planar_video_copy_footprints`). - **Live native `ID3D12Device::GetCopyableFootprints` differential parity matrix (RTX 5090 and WARP):** - Compared VIctory's `copyable_footprints` against live native `ID3D12Device::GetCopyableFootprints` across `NV12` (`103`) and `P010` (`104`) x 8 sizes (`2x2`, `4x4`, `64x64`, `130x66`, `256x128`, `514x258`, `1920x1080`, `3840x2160`) x 1-3 array slices x every valid `(first, count)` subrange x base offsets `0`, `512`, `4096`: - **RTX 5090:** **1,632 queries / 3,840 plane entries — 0 mismatches** across `Offset`, `Format`, `Width`, `Height`, `Depth`, `RowPitch`, `NumRows`, `RowSizeInBytes`, and `TotalBytes`. - **WARP:** **1,632 queries / 3,840 plane entries — 0 mismatches**. - Invalid descriptors (`odd_w`, `odd_h`, `mip_levels = 0`, `mip_levels = 2`, `sample_count = 4`) for both `103` and `104`: **10/10 matched** native `u64::MAX` (`0xffffffffffffffff`) on both RTX 5090 and WARP. ### Review Notes - Descriptor validation (`crates/victory-gpu/src/resource.rs:349-362`) enforces 2D, single mip, single sample, valid array slice count (`1..=2048`), and even dimensions `>= 2` before applying the plane 0/1 copy formats (`R8`/`R8G8` for `NV12`, `R16`/`R16G16` for `P010`), 512-byte row-pitch alignment, and half-extent shift (`crates/victory-gpu/src/resource.rs:383-395`). - Self-contained and matches native D3D12 field-for-field on both hardware and software backends. Looks good to merge.
Dukestar69 commented 2026-11-26 23:09:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T23:09:18Z.

Review: APPROVED


LGTM — verified on RTX 5090 (Windows / D3D12) against origin/main (63bcca4).

  • Returning luma and chroma copyable footprints for NV12 and P010 planar formats is clean and well-tested.
  • cargo test -p victory-gpu --lib resource:: -- --test-threads=1: all passed.
  • 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).

<!-- greyfinch-sync:Marvisak/VIctory:review:6081360921 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1984#pullrequestreview-6081360921). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T23:09:18Z. **Review:** APPROVED --- LGTM — verified on RTX 5090 (Windows / D3D12) against `origin/main` (`63bcca4`). - Returning luma and chroma copyable footprints for NV12 and P010 planar formats is clean and well-tested. - `cargo test -p victory-gpu --lib resource:: -- --test-threads=1`: all passed. - `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).
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/1984:upstream-pr/1984'
git switch 'upstream-pr/1984'

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/1984'
git switch 'upstream-pr/1984'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1984'
git switch 'upstream-pr/1984'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1984'
git switch 'main'
git merge --squash 'upstream-pr/1984'
git switch 'main'
git merge --ff-only 'upstream-pr/1984'
git switch 'main'
git merge 'upstream-pr/1984'
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!1982
No description provided.