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

Open
github-bot wants to merge 2 commits from github-bot/gh-1984 into main AGit
Owner

@⁠yuniskh on GitHub · 2026-11-25 02:19 UTC · original
yuniskh:gpu/nv12-p010-copy-footprints → main · +111 −12 · 1 files · 2 commits · open

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

**@⁠yuniskh** on GitHub · 2026-11-25 02:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1984) `yuniskh:gpu/nv12-p010-copy-footprints` → `main` · +111 −12 · 1 files · 2 commits · open 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://git.gtahub.st/github/Marvisak--VIctory/issues/386) · [Test logs and reproduction steps](https://github.com/yuniskh/VIctory/blob/34194a0fa82084391f55689746e26db67f0f5387/reports/2026-11-24/gpu-verification/README.md#nv12-and-p010-footprints)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:50:41 +00:00
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-25 02:28 UTC · original

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.

**@⁠DesertGamer** on GitHub · 2026-11-25 02:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/1984#issuecomment-7150759632) ### 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.*
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:26 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 08:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1984#issuecomment-7157034430) <!-- 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)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 01:37 UTC · original

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** on GitHub · 2026-11-26 01:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/1984#issuecomment-7179956045) 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.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 02:48 UTC · original · reviewed

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.

**@⁠catminou4** on GitHub · 2026-11-25 02:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1984#pullrequestreview-6051087124) · **reviewed** 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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 13:09 UTC · original · approved these changes

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.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 13:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/1984#pullrequestreview-6074679175) · **approved these changes** 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1984/head:github-bot/gh-1984'
git switch 'github-bot/gh-1984'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1984'
git switch 'github-bot/gh-1984'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1984'
git switch 'github-bot/gh-1984'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1984'
git switch 'main'
git merge --squash 'github-bot/gh-1984'
git switch 'main'
git merge --ff-only 'github-bot/gh-1984'
git switch 'main'
git merge 'github-bot/gh-1984'
git push origin 'main'
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!1984
No description provided.