GPU: handle depth/stencil copy footprints #504
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!504
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/504/head"
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?
@broccolize on GitHub · 2026-11-24 04:16 UTC · original
broccolize:gpu/depth-stencil-copy-footprints→main· +67 −12 · 1 files · 1 commits · merged 2026-11-25 00:11 UTCGetCopyableFootprintsnow returns separate depth and stencil layouts with 512-byte row alignment. The regression test covers both DXGI depth/stencil format families across two mips and two array slices.The regression failed on
mainand passes with this change. A local harness matched 528 native D3D12 queries per adapter on the GTX 1650, Intel UHD Graphics, and WARP.On Windows with Rust 1.98.1 (GNU), the GPU suite passed 44 tests by default and 46 with diagnostics. Both runs had zero failures and one ignored benchmark. The asset policy and
git diff --checkpassed.AI-assisted with Codex. All checks used synthetic inputs.
@fromthemoonx on GitHub · 2026-11-24 04:40 UTC · original
Tested
b956320(onmaind2a4bae) on another adapter, with a wider native comparison.Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X, 16 GB, NVIDIA GeForce RTX 3060 12 GB (driver 610.88), Rust 1.98.1
x86_64-pc-windows-msvc(MSVC rather than GNU), debug.Native comparison (a throwaway test in
resource.rs, not pushed): the same description went tocopyable_footprintsand to the RTX 3060 device's ownGetCopyableFootprints, comparing offset, format, width, height, depth, row pitch, row count, row size and total for every record.ALLOW_DEPTH_STENCIL(depth formats)firstwithcountrunning to the last subresourcemain(same harness)On
mainthe mismatches are the depth/stencil formats, as the description says: plane 0 reports the view format with a 256-byte pitch, and plane 1 comes back with the all-ones values (e.g. f19 1×1: nativeR32_TYPELESS, pitch 512, thenR8_TYPELESSat offset 512; total 513 againstu64::MAX).Other checks
cargo test --locked -p victory-gpu --lib: 44 passed, 0 failed, 1 ignored, includingdepth_stencil_footprints_follow_the_pc_plane_ordercargo test --locked --workspace: 265 passed, 0 failed, 4 ignoredcargo xtask policy: 151 files ok;git diff --check: cleancargo fmt --checkreport only whatmainalready has (host.rs:267safety comment, and aformat!inhost_texture), nothing in the changed linesNot tested: copies through these footprints on the GPU (layout calculation only); no game data used.
AI-assisted (Claude Code) ran the checks and drafted this comment.
@Dathinel on GitHub · 2026-11-24 06:31 UTC · original
I checked how #409 and #504 interact when a depth/stencil query starts at an unaligned base. On an RTX 3050 Laptop GPU, for a 16×8 D24_UNORM_S8_UINT texture with two mips and two array slices,
GetCopyableFootprints(first=3, count=2, base=513)crosses from the last depth subresource into stencil:340499c)b956320)I resolved the
resource.rsconflict locally againstd2a4baeby taking #504’s format and row-pitch selection per plane, applying #409’s block dimensions to that format, and keeping #409’s placement relative to the caller’s base. The result matched all 38 native records and all seven totals across RGBA8 and D24/S8 with bases 0, 1 and 513.A regression test with those two expected rows and the total runs without a GPU. It failed on each PR for the reason above. All four filtered footprint tests passed on the combined tree, including both PRs’ original regressions. This covered layout queries only. The placement and plane fixes are from the authors of #409 and #504. AI-assisted, using synthetic descriptions.
Both changes remain attributable to their respective PRs. For the next rebase, here is the single-file resolution and CPU regression. It is an experimental merge of the two GitHub test merges. Run
cargo test --frozen -p victory-gpu --lib resource::tests::depth_stencil_footprints_preserve_an_unaligned_base_across_planes -- --exacton that commit.@fromthemoonx on GitHub · 2026-11-24 06:40 UTC · original
A correction to my run above, and @Dathinel's combined resolution on the RTX 3060.
My "0 mismatches" used bases 0, 512 and 1024 only, all 512-aligned. I re-ran the same harness (same formats, sizes, mips, arrays, flags and
first/countranges) with unaligned bases 1, 256 and 513 against nativeGetCopyableFootprints:maind2a4baeb9563203f1d688(#409 + this PR)With an unaligned base, native places the first subresource at the base itself (e.g. f19 1×1, base 1: native offsets 1 and 513, total 513), while
mainand this PR round it up to 512 (offsets 512 and 1024, total 1024). That happens for every format, so it's older than this PR and is #409's part, as Dathinel says. On3f1d688,cargo test --locked -p victory-gpu --libgives 46 passed, 0 failed, 1 ignored, including both PRs' regressions anddepth_stencil_footprints_preserve_an_unaligned_base_across_planes.So on NVIDIA desktop too, that resolution matches native for both the plane layout and the base placement.
Layout queries only; no game data used. AI-assisted (Claude Code).
@broccolize on GitHub · 2026-11-24 07:29 UTC · original
Thanks @Dathinel for the combined patch and @fromthemoonx for checking both aligned and unaligned bases against native D3D12.
Which PR should land first, #409 or #504? If #409 lands first, I can rebase this PR using the tested resolution.
@Dathinel on GitHub · 2026-11-24 07:53 UTC · original
I'd land #409 first, then rebase #504 on it as you suggest. #409 fixes placement relative to the caller's base and the packed-format row sizes reported in #386. #504 can then add plane-specific formats and pitches on top, keeping both sets of regressions.
I checked both orders against
main@c2e7254. Applying the correspondingresource.rsresolution produced the same Git tree either way. All four footprint tests passed on that combined tree, including the unaligned cross-plane case. When rebasing, the tested resolution is a reference for the conflicting hunk. You can check the result withcargo test --locked -p victory-gpu --lib footprints. Thanks for taking the rebase. AI-assisted.