GPU/Resource: support 2-plane D16_UNORM_S8_UINT formats (118..=120) in GetCopyableFootprints #3055
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3057"
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?
Imported from Marvisak/VIctory. Originally posted by RVZO6 on 2026-11-26T05:43:04Z.
Problem
In
crates/victory-gpu/src/resource.rs,subresource()(used byGetCopyableFootprints) only recognizes 2-plane depth-stencil formats19..=22(D32_FLOAT_S8X24_UINTfamily) and44..=47(D24_UNORM_S8_UINTfamily), omitting console 2-plane 16-bit depth + 8-bit stencil formats118..=120(DXGI_FORMAT_D16_UNORM_S8_UINT,R16_UNORM_X8_TYPELESS,X16_TYPELESS_G8_UINT— already treated as 2-plane[R16, R8]intwin.rs:101andvictory-formats/src/texture.rs:766).On
main:(desc.format, 256), returning raw console format118..=120withelement == (3, 1)(1.5xwrongrow_size, 256-byte row alignment instead of 512).None, causingcopyable_footprintsto emitNO_FOOTPRINT(u64::MAX) andtotal = u64::MAX.Fix
Handle
(118..=120, 0) => (53, 512)(DXGI_FORMAT_R16_TYPELESS, 2 B/texel) and(118..=120, 1) => (60, 512)(DXGI_FORMAT_R8_TYPELESS, 1 B/texel) insubresource(). Disjoint from #1543 (which adds checked arithmetic overflow guards).Verification
resource::tests::d16_s8_depth_stencil_footprints_follow_the_pc_plane_order(2 mips × 2 slices × 2 planes across formats118..=120).format 118with plane-0(512, 118, ...)/256-aligned offsets and plane-1u64::MAX; passes 2/2 after fix.windows-latestMSVC + WARP SM 6.6 CI (cargo clippy --workspace --all-targets --locked -- -D warnings,--all-features,xtask policy, full workspace tests): https://github.com/RVZO6/VIctory/actions/runs/45762903919AI-assisted: T3 Code (Antigravity, gemini-4-neon)
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T05:55:32Z.
Review: APPROVED
Reviewed head
10c9fdf2line-by-line (CI green):element()(118..=120 => (3, 1)) andpc_format()(118..=120 => 20..=22) inresource.rs: plane 0 maps toDXGI_FORMAT_R16_TYPELESS(53, 2 B/texel) and plane 1 maps toDXGI_FORMAT_R8_TYPELESS(60, 1 B/texel), both with 512-byte row pitch alignment.d16_s8_depth_stencil_footprints_follow_the_pc_plane_orderverifies offsets, formats, dimensions, row counts, row sizes, total size (24_072), and out-of-range subresource (8) across all three formats (118..=120).Clean and well-tested.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T06:00:06Z.
Review: APPROVED
Verified: 118..=120 (D16_UNORM_S8_UINT family) is the missing two-plane depth-stencil case — plane 0 was falling through to the console format and plane 1 returned None. The match now maps them to R16_TYPELESS/R8_TYPELESS at 512-byte pitch like the D24/D32 family, and the test pins the PC plane order (all depth subresources then all stencil), exact offsets, and the count boundary for all three formats.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T06:30:23Z.
Review: APPROVED
Tested locally merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):D16_UNORM_S8_UINTformats (118..=120) as two 512-byte-aligned planes (R16_TYPELESS= 53 for plane 0,R8_TYPELESS= 60 for plane 1) inresource::subresourcecleanly extendsGetCopyableFootprintsto 16-bit depth + 8-bit stencil textures.cargo test -p victory-gpu resource::tests -- --test-threads=1: 19 passed, 0 failed (includingd16_s8_depth_stencil_footprints_follow_the_pc_plane_order).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).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:16:48Z.
Automated triage for the maintainers.
Merge candidate.
subresource()incrates/victory-gpu/src/resource.rs(behindGetCopyableFootprints) treated only formats 19..=22 and 44..=47 as two-plane depth-stencil, so the 16-bit depth + stencil formats 118..=120 got the raw format with a 256-byte pitch for plane 0 andNO_FOOTPRINTfor plane 1. The PR maps them to R16_TYPELESS (53) and R8_TYPELESS (60) with 512-byte row alignment, which matches how the rest of the repo already splits these formats (twin.rsplane_formats:[R16, R8];victory-formatstexture::format: 2 bytes with stencil). I checked the new test's expected offsets, row sizes and total by hand.These footprints follow the PC plane-copy rules by analogy with the D32S8/D24S8 cases. Nobody has confirmed them against the console runtime, but on
mainplane 1 has no footprint at all.CI:
checkpassing.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.