Repository navigation
Runtime: support shifted depth and stencil resolves - #4745
gabrielsteglich wants to merge 2 commits into
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Built and ran both tests at 68a33c756 on Windows 11, RTX 5070 Ti:
d3d12_depth_resolve_test-> exit 0:42 of 42 matchagainst the NVIDIA host,36 of 36 matchagainst WARP, 5 refusals alike;11 shifted cases matched the clears, 78 host comparisons matched, 9 refusals kept the destination.replay_depth_resolve_offset_test-> exit 0:intermediate failures and stencil-only copy verified.
Shifted depth and stencil resolves are now replayed with the correct offsets through vulkan_replay.h/vulkan_backend.h, and the two tests cover the shifted rects, the host comparisons, refusals and the stencil-only copy. git diff --check clean. No blocking issue.
|
Tested
No blocking issue. AI-assisted. |
|
Verified commit
Reviewed AI-assisted (Gemini, Antigravity). |
|
PASS. MSVC build of the new and existing depth-resolve tests; One non-blocking cost: the temporary image is full-mip-sized even for a small source rectangle ( Approve. AI-assisted review, no game files, no game data. |
|
Clean merge with current main; both docs guards pass on the merged tree. Static review only — the shifted-bounds check, selected-aspect copy and scratch-retention changes read coherently, but neither the C++ replay mock nor the Windows/GPU depth-resolve test was built or run on this CPU-only host, and no directly relevant Python suite exists. Main's 489258f covers the colour-resolve path, not this depth/stencil one, so this is new ground. Please treat the pending CI as the functional verdict before merging. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only review). |
|
Tested 68a33c7 on NVIDIA GeForce RTX 4080, driver 617.42, Windows 11 (clang-cl cross-build): d3d12_depth_resolve_test exits 0 with "depth/stencil resolves against NVIDIA GeForce RTX 4080: 27 of 42 match, 15 host quirks, 5 refusals alike", "against WARP: 36 of 36 match" and "11 shifted cases matched the clears, 63 host comparisons matched, 9 refusals kept the destination". replay_depth_resolve_offset_test exits 0 and prints "intermediate failures and stencil-only copy verified". The validation layer was not loaded in this run, and I did not check the stack base (the PR body lists #3977 and #3019). AI-assisted. |
|
Tested
AI-assisted (Claude Code). |
ResolveSubresourceRegion with AVERAGE and a Format other than the textures' own (a typeless pair as UNORM_SRGB, a typeless source with a typed UNORM_SRGB destination) took the depth/stencil check and was refused. It now passes the view format like ResolveSubresource, and replay resolves the rectangle in a rendering scope with both images viewed in it. A rendering scope resolves each pixel in place, so a rectangle moved to other destination coordinates is refused for now, like a destination without ALLOW_RENDER_TARGET: both wait for a temporary attachment and a copy (ItsNotRexed#4745's shape). d3d12_resolve_format_test: three region cases into a destination cleared red first. Under Wine 9.0 on llvmpipe the rectangle holds 137/225 and every other pixel stays red (0 wrong of 256) for typeless and mixed sources; the moved rectangle is refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GN11jcpJWD4phrXJyDgED6
…-411) ResolveSubresource dropped its Format: a typeless pair resolved as UNORM_SRGB was averaged as UNORM (no error, darker edges), and a typeless source with a typed UNORM_SRGB destination was refused because the Vulkan formats differ. ResolveSubresourceRegion refused both. The front end now passes the format both resources are viewed in when it isn't their own (color_resolve_view_format: a typed, non-integer member of a MUTABLE_FORMAT resource's family, in its view-format list, of the same texel size). Replay resolves such a colour resolve in a rendering scope with both images viewed in that format: a colour attachment with an AVERAGE resolve, on the depth/stencil resolve path. A destination without ALLOW_RENDER_TARGET has no attachment usage, and a rendering scope resolves each pixel in place, so a destination without it, or a rectangle moved to other coordinates, resolves into a one-sample scratch image and is copied over (vkCmdCopyImage between size-compatible formats). This reuses ItsNotRexed#4745's depth resolve scratch images, which now get colour attachment usage for a colour aspect. d3d12_resolve_format_test clears a 4x target to blue and writes green to one sample of four (SampleMask 0x1), so every pixel resolves to 64/191 as UNORM and 137/225 as sRGB averaged linearly (native D3D12 and WARP give 137/225, with or without ALLOW_RENDER_TARGET on the destination). Eight cases: typed and typeless sources, typeless and typed sRGB destinations, a destination without ALLOW_RENDER_TARGET, and three regions into a destination cleared red (in place, typed sRGB, moved). Under Wine 9.0 on llvmpipe all eight give the expected value on every pixel; main gives 64/191 for the typeless sRGB cases and refuses the others. Depends on: ItsNotRexed#4745 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GN11jcpJWD4phrXJyDgED6
|
Tested
AI-assisted (Claude Code). |
|
Tested 2f3daa2 merged with main 8575d36 on native Windows 11, MSVC 14.51, Ninja RelWithDebInfo (default Vulkan device, not recorded): pass |
Claimed in coordination issue #4683.
Depends on: #3977, #3019
The branch is based directly on
main. #3977 overlaps invulkan_replay.h. #3019 already conflicts withmainand changes the same replay paths.What and why
ResolveSubresourceRegioncan now write a depth or stencil rectangle to a different origin in a same-format 2D texture. Replay resolves the selected plane into a single-sample temporary image at the source coordinates, then copies only that rectangle to the destination. This preserves the surrounding texels and other plane.The command queue keeps temporaries alive until submitted work is complete. The D3D12 entry point checks source and destination mip bounds. Enhanced barriers with
SYNC_RESOLVEcover the final Vulkan copy.Tested
Commit
68a33c75on Windows 11 Pro build 26300, NVIDIA GeForce RTX 3090 with driver 621.01, MSVC 19.44.35229, Windows SDK 10.0.26100.0, Vulkan SDK 1.4.363.0, RelWithDebInfo. Vulkan synchronization validation was enabled withLEONIDA_VK_VALIDATION=1.98fa503freturnedE_INVALIDARGatClosefor all 11 shifted cases in the new fixture. The patch passes all 11, covering 13 shifted copies, rectangle edges, overlapping writes with Enhanced Barriers, and consecutive submissions on one DIRECT queue. Nine negative cases preserve the destination.AI-assisted: yes. Independently reviewed before submission.
Checklist