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

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

@⁠Snooozs on GitHub · 2026-11-25 15:29 UTC · original
Snooozs:depth-copy-encodings → main · +184 −3 · 3 files · 2 commits · open

Claimed in the coordination issue as: RT-DEPTH-COPY-ENCODING-MISMATCH (#1608). 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: #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 #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

**@⁠Snooozs** on GitHub · 2026-11-25 15:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1905) `Snooozs:depth-copy-encodings` → `main` · +184 −3 · 3 files · 2 commits · open Claimed in the coordination issue as: RT-DEPTH-COPY-ENCODING-MISMATCH (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608). 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**: #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 #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](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:10:42 +00:00
Author
Owner

@⁠Tyrannys on GitHub · 2026-11-25 18:12 UTC · original · edited 2026-11-25 18:55 UTC

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)
  • WRITE_INVALID: the world-start WRITE_INVALID did not happen in either run. On this machine it ended an earlier run with host image copies on (main 42537e7b6 + #1631; my run table of 07:54 in #1608).
  • #1950 / #1886: in run 1 the exit filter ran on the title's fatal exception: "1 pipeline build(s) still running at exit; writing the pipelines finished so far". It then refused the write: "pipeline cache is 9722912321 bytes, over the 4294967296-byte write limit". With a seeded offline cache, the union is past 4 GiB, so nothing from the session was kept. This is the seeded case raised on #1886. No session file was written in either run.

AI-assisted (Claude Code).

**@⁠Tyrannys** on GitHub · 2026-11-25 18:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1905#issuecomment-7170580491) · edited 2026-11-25 18:55 UTC 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) | - **WRITE_INVALID:** the world-start WRITE_INVALID did not happen in either run. On this machine it ended an earlier run with host image copies on (`main` `42537e7b6` + #1631; my run table of 07:54 in #1608). - **#1950 / #1886:** in run 1 the exit filter ran on the title's fatal exception: "1 pipeline build(s) still running at exit; writing the pipelines finished so far". It then refused the write: "pipeline cache is 9722912321 bytes, over the 4294967296-byte write limit". With a seeded offline cache, the union is past 4 GiB, so nothing from the session was kept. This is the seeded case raised on #1886. No session file was written in either run. AI-assisted (Claude Code).
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-25 18:22 UTC · original · reviewed

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)

**@⁠MoonEyes** on GitHub · 2026-11-25 18:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1905#pullrequestreview-6062815340) · **reviewed** **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)
Author
Owner

@⁠Snooozs on GitHub · 2026-11-26 10:27 UTC · original

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

  • windows: vk_xdxr_postbuild_readback fails in 0.02 s on the runner (no device with bufferDeviceAddress), fix #1418.
  • linux-gpu-tools build: vk_null_descriptor_test.cpp:97 uses LEONIDA_TEST_NULL_DESCRIPTORS_SPV, which only exists when glslangValidator is found, fix #2055.
  • macos: cs_imgatomic_ext fails on MoltenVK, fix #1518.

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

**@⁠Snooozs** on GitHub · 2026-11-26 10:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1905#issuecomment-7189391100) The red CI jobs here are failures that `main` has now too, each with an open fix: - `windows`: `vk_xdxr_postbuild_readback` fails in 0.02 s on the runner (no device with bufferDeviceAddress), fix #1418. - `linux-gpu-tools` build: `vk_null_descriptor_test.cpp:97` uses `LEONIDA_TEST_NULL_DESCRIPTORS_SPV`, which only exists when glslangValidator is found, fix #2055. - `macos`: `cs_imgatomic_ext` fails on MoltenVK, fix #1518. Nothing in this PR touches those files. AI-assisted (Claude Code).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1905/head:github-bot/gh-1905'
git switch 'github-bot/gh-1905'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1905'
git switch 'github-bot/gh-1905'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1905'
git switch 'github-bot/gh-1905'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1905'
git switch 'main'
git merge --squash 'github-bot/gh-1905'
git switch 'main'
git merge --ff-only 'github-bot/gh-1905'
git switch 'main'
git merge 'github-bot/gh-1905'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.