Skip to content

replay: depth copies between different encodings are left out, stencil planes staged (RT-DEPTH-COPY-ENCODING-MISMATCH) - #1905

Open
Snooozs wants to merge 1 commit into
ProjectLeonida:mainfrom
Snooozs:depth-copy-encodings
Open

Snooozs wants to merge 1 commit into
ProjectLeonida:mainfrom
Snooozs:depth-copy-encodings

Conversation

@Snooozs

@Snooozs Snooozs commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: RT-DEPTH-COPY-ENCODING-MISMATCH (#1608 (comment)). The follow-up to #1893 that @OreoFR left to me.

Depends on: #1893 (this branch contains its commit; the diff to review is the last commit).

What and why

vkCmdCopyImage accepts depth/stencil images only when their formats are equal (VUID-vkCmdCopyImage-srcImage-01548), whichever aspect is copied. #1893 stages the depth plane between formats of one encoding. Three cases were still handed to the driver:

  • Depth planes of different encodings (D24_UNORM_S8_UINT into D16_UNORM or D32_SFLOAT, D32_SFLOAT_S8_UINT into D16_UNORM): D3D12 has no such copy, but the layer can make one out of a legal console copy, since the console's D16S8 is made as D24S8 on NVIDIA. That one copy is now left out and logged (at most 8 lines), and the list still replays; refusing it would drop the whole submission. A converting copy can replace this if a title is ever seen asking for it.
  • The stencil plane between different depth-stencil formats (8 bits in each): staged, as the depth plane is.
  • A multisampled pair: replay: copies between depth formats that differ go through transfer scratch (RT-DEPTH-FORMAT-COPY-STAGED) #1893 would stage it, but vkCmdCopyImageToBuffer takes no multisampled image. Left out, as above.

depth_stencil_copy makes the choice; nothing changes for equal formats, colour copies or depth to colour.

Tested

  • replay_copy_offset_test (no GPU), new cases: exit 0 with the change; with vulkan_replay.h of replay: copies between depth formats that differ go through transfer scratch (RT-DEPTH-FORMAT-COPY-STAGED) #1893 under the same test 7 checks fail (five left-out pairs, the staged stencil plane, its scratch size).
  • Windows 10 Pro 19045, NVIDIA GeForce RTX 5060 Ti, driver 621.01, MSVC 14.43 RelWithDebInfo: vk_command_replay, d3d12_noop_copy, d3d12_clear, d3d12_depth_resolve, d3d12_typeless_depth, d3d12_subresource_copy, xbox_depth_storage, d3d12_copy_xfmt, d3d12_a8_copy, d3d12_stencil_copy, d3d12_depth24_draw, replay_copy_offset: 12 of 12 pass.
  • scripts/check_no_game_data.py on the changed files: OK.
  • Not run: the whole ctest set, a retail boot with this commit, AMD or Intel. Whether the retail title makes any of these copies is not known.

AI-assisted: yes (Claude Code).

🤖 Generated with Claude Code

…taged (RT-DEPTH-COPY-ENCODING-MISMATCH)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Tyrannys

Tyrannys commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Test report from a combined build on a second NVIDIA machine. Counts only.

Machine: Windows 11, RTX 4070 SUPER, NVIDIA 621.01, 64 GB, own 1.0.2.1 copy.

Build: main fe1553456 (already contains #1827 and #1893), plus #674, #1662, #1851, #1849, #1905, #1957, #1950, #1886 and #1894. All of them merged without conflicts.

Shaders: translated on 3de22a190 + #674 + #1662 with --wave64-emulate. 29,279 of 29,280 translated, and all 29,279 pass spirv-val. That is 2,683 library programs and 29 of 29 FSPX. main's translator changes since then are correctness fixes only.

Pipeline cache: warm and complete, 26,503 of 26,503 (9.6 GB).

  • Three library compute programs took 30 to 32 minutes each to build alone: the ScreenProbes ActivateRays, ActivateProbes and ActivateProbesTarget programs of indirect diffuse lighting.
  • Building all three at once crashed the NVIDIA compiler ("NVVM compilation failed: 3", after 22 minutes).

Recipe: scripts/windows-boot/boot.ps1 -Seconds 480, LEONIDA_KEYBOARD_PAD=1 LEONIDA_SKIP_INT3=1 LEONIDA_TITLE_WINDOWS_MB=1024 LEONIDA_MAP_READBACK=1, LEONIDA_PIPELINE_CACHE_DIR pointing at the offline cache. Host image copy: off (auto: NVIDIA) from #1851. One run per row.

run 1 run 2 (+ LEONIDA_TITLE_WATCHDOG=0)
end 344 s: the title's hang watchdog (null write at game_scarlett_master.exe+0x23cf683) full 484 s, stopped by the script
device loss / fault report none none
D3D12 calls 330,487 375,686
ExecuteCommandLists 5,490 6,017
Dispatch / DrawIndexedInstanced 2,435 / 2,726 2,779 / 6,026
PresentX 1,358 ok, 0 failed 1,465 ok, 0 failed
captures 23, all non-black 25, all non-black
indirect draws recorded / emitted / skipped 64 / 0 / 5,092 128 / 34 / 9,244 (#429 not included)

AI-assisted (Claude Code).

@MoonEyes MoonEyes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Setup: Windows 11 Pro 26300, MSVC 19.44.35230.0 (VS 2022), CMake 3.31.6 + Ninja, RelWithDebInfo, -DLEONIDA_REQUIRE_VULKAN=ON, Vulkan SDK 1.4.363.0. main = b9320a118. Only replay_copy_offset_test was built and run (ctest -R "^replay_copy_offset$"). Not run: the whole ctest set, any game boot.

Head 365b8ff08.

  • PR head: replay_copy_offset Passed (1/1).
  • main: Passed (1/1).
  • PR merged into main locally: Passed (1/1). main changed vulkan_replay.h and this test since the PR's base (the +4 host-prefix staging); git merged both files without conflict and the merged test passes, so the PR does not need a rebase for this test.
  • Mutant (merged test, runtime/src/vulkan_replay.h of main): Failed with 7 FAIL: lines: 5 times a depth copy between different encodings (or multisampled formats) records no copy, then a stencil plane copy between different formats is staged, stencil aspect on both sides and the stencil scratch holds one byte a texel. That is the "7 checks fail" of the description, reproduced against current main.

Not checked here: the GPU tests listed in the description (d3d12_stencil_copy, d3d12_depth24_draw and the others). replay_copy_offset_test records the Vulkan calls through mocks and makes no device.

AI-assisted: yes (Claude Code built and ran the tests)

@Snooozs

Snooozs commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

The red CI jobs here are failures that main has now too, each with an open fix:

Nothing in this PR touches those files. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants