GPU: honor BaseOffset in GetCopyableFootprints #3287

Open
github-bot wants to merge 1 commit from github-bot/gh-3287 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 15:59 UTC · original
andrewpozdnakov7-jpg:fix/386-copyable-base-offset → main · +62 −2 · 1 files · 1 commits · open

Refs #386.

GetCopyableFootprints adds BaseOffset to each subresource's relative layout. The shim aligned the absolute position instead. A 10×6 RGBA8 texture with two mips at base 1 returned offsets 512 and 2048 on main. Native D3D12 returned 1 and 1537. Microsoft API documentation

Keep subresource alignment relative to the base and add the base exactly as supplied. This addresses the base-offset result from #386 and credits the earlier patch in #409.

Verification

  • The new regression fails on main 63bcca4 at base 1 and passes with the patch. It checks bases 0, 1, 255, 512 and 513 against native D3D12 on app-local WARP 1.0.22 / Agility 1.620.2. The total is 2,068 bytes at each base.
  • All 19 resource tests passed. Full GPU lib run passed 247 tests with 1 ignored. Strict GPU Clippy passed with and without all features, and policy passed.
  • Synthetic layout queries only.

AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 15:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/3287) `andrewpozdnakov7-jpg:fix/386-copyable-base-offset` → `main` · +62 −2 · 1 files · 1 commits · open Refs #386. `GetCopyableFootprints` adds `BaseOffset` to each subresource's relative layout. The shim aligned the absolute position instead. A 10×6 RGBA8 texture with two mips at base 1 returned offsets 512 and 2048 on main. Native D3D12 returned 1 and 1537. [Microsoft API documentation](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-getcopyablefootprints) Keep subresource alignment relative to the base and add the base exactly as supplied. This addresses the base-offset result from #386 and credits the earlier patch in #409. ## Verification - The new regression fails on main `63bcca4` at base 1 and passes with the patch. It checks bases 0, 1, 255, 512 and 513 against native D3D12 on app-local WARP 1.0.22 / Agility 1.620.2. The total is 2,068 bytes at each base. - All 19 resource tests passed. Full GPU lib run passed 247 tests with 1 ignored. Strict GPU Clippy passed with and without all features, and policy passed. - Synthetic layout queries only. AI-assisted with Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 16:04:25 +00:00
Author
Owner

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

Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090):

  • Computing footprint.offset = base + (end - base).next_multiple_of(PLACEMENT) aligns subresources relative to base and matches native ID3D12Device::GetCopyableFootprints across both aligned and unaligned base offsets.
  • cargo test -p victory-gpu --lib resource:: -- --test-threads=1 (RTX 5090): 19 passed, 0 failed (including copyable_footprints_add_the_exact_base_offset).
  • 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).

**@⁠Dukestar69** on GitHub · 2026-11-26 16:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/3287#pullrequestreview-6077296994) · **approved these changes** Reviewed the diff and verified locally on Windows 11 x64 (RTX 5090): - Computing `footprint.offset = base + (end - base).next_multiple_of(PLACEMENT)` aligns subresources relative to `base` and matches native `ID3D12Device::GetCopyableFootprints` across both aligned and unaligned `base` offsets. - `cargo test -p victory-gpu --lib resource:: -- --test-threads=1` (RTX 5090): 19 passed, 0 failed (including `copyable_footprints_add_the_exact_base_offset`). - `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).
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-26 17:01 UTC · original

I checked this exact b06f7d7 with #2193 at a3c16a3. They merge cleanly. The cross-PR regression 8e690a1 creates a 10x6 RGBA8 texture with automatic mips and two array slices. It takes the guest GetDesc result and queries three footprints that cross the slice boundary, then compares dimensions, pitch, row counts, row sizes, offsets and total bytes against native D3D12.

The same test failed three times on this PR alone at GetDesc (0 instead of 4 mips). It failed three times on #2193 alone at the first unaligned base. The integration passed three runs at bases 0, 1 and 513, with row counts [1, 6, 3] and 2,580 bytes each time. On verified app-local Agility 1.620.2/WARP 1.0.22, resource tests passed 22/22 and GPU diagnostics 251/0/1, including runtime identity. Strict GPU Clippy passed in both configurations. Policy passed.

The maintainers can land both fixes independently. The regression is available once both are present. Please retain its Git author on cherry-pick, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding it into another commit. AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-26 17:01 UTC · [original](https://github.com/Marvisak/VIctory/pull/3287#issuecomment-7198392234) I checked this exact `b06f7d7` with #2193 at `a3c16a3`. They merge cleanly. The [cross-PR regression `8e690a1`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/8e690a11a9c35dd92b5b99262b4a034ca81d1632) creates a 10x6 RGBA8 texture with automatic mips and two array slices. It takes the guest `GetDesc` result and queries three footprints that cross the slice boundary, then compares dimensions, pitch, row counts, row sizes, offsets and total bytes against native D3D12. The same test failed three times on this PR alone at `GetDesc` (0 instead of 4 mips). It failed three times on #2193 alone at the first unaligned base. The integration passed three runs at bases 0, 1 and 513, with row counts [1, 6, 3] and 2,580 bytes each time. On verified app-local Agility 1.620.2/WARP 1.0.22, resource tests passed 22/22 and GPU diagnostics 251/0/1, including runtime identity. Strict GPU Clippy passed in both configurations. Policy passed. The maintainers can land both fixes independently. The regression is available once both are present. Please retain its Git author on cherry-pick, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding it into another commit. AI-assisted with Codex.
This pull request can be merged automatically.
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/3287/head:github-bot/gh-3287'
git switch 'github-bot/gh-3287'

Merge

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