Skip to content

d3d12: reject incompatible depth attachments in replay - #9657

Closed
Sasavn wants to merge 1 commit into
ProjectLeonida:mainfrom
Sasavn:codex/d3d12-depth-attachment-format
Closed

Sasavn wants to merge 1 commit into
ProjectLeonida:mainfrom
Sasavn:codex/d3d12-depth-attachment-format

Conversation

@Sasavn

@Sasavn Sasavn commented Nov 23, 2026

Copy link
Copy Markdown

Claimed in the coordination issue as Reject incompatible depth attachment formats in Vulkan draw replay.

What and why

Draw preparation used the pipeline's depth format to create a view of the bound image. A D32 pipeline could therefore request a D32 view of a D32+S8 image. Vulkan depth/stencil formats each have their own view compatibility class. Vulkan format compatibility classes

Check the backing format and aspects before requesting the depth view. Valid draws use the backing format directly.

Tested

  • The synthetic draw regression fails against unmodified main and passes with the check. It verifies that replay refuses the draw before requesting a depth view.
  • Six replay CTests pass. The native d3d12_typeless_depth test passes on Windows 11 build 26300, MSVC 14.44, RTX 3080 and NVIDIA 621.01.
  • The full semantic suite ran 447 files and 5,957 tests. The two failing files, test_image_atomics_guard and test_image_store_d16, reproduce on clean main at 5d74c272.
  • scripts/check_no_game_data.py and git diff --check pass.

AI-assisted: yes.

  • No game data, keys, decryption or game logs.

@MarcPique

Copy link
Copy Markdown

I tested a narrow follow-up on top of 47aef386. It preserves your rejection of mismatched attachment formats and handles the valid depth-only case where a D32 pipeline uses the depth aspect of a D32S8 image. The view and the dynamic-rendering pipeline variant both use the backing Vulkan format. The stencil aspect remains unbound.

The change and a standalone draw regression are in MarcPique/Leonida@c32f64c, available to pick up here. Your replay rejection test now uses D24S8 versus D32 to retain the negative control.

d3d12_draw and replay_cpu_bench_selftest passed on Windows/MSVC with an RTX 4090 and AMD Radeon Graphics. The new test matched all 4,096 pixels on each GPU. The first draw writes depth and the second draw at the same depth is rejected by LESS. Both runs used the available drivers without Vulkan validation layers. The game-independent data check and git diff --check also passed.

The same narrow change in a local integration build stopped a previously reproduced NVIDIA 3D-Z KIND Violation with depth testing and writing enabled. That run recorded at least 26,624 successful presentations in 130 seconds and the displayed image remained black.

AI-assisted (Codex).

@smowlyy

smowlyy commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified on native Windows 11 (10.0.26300.9974, MSVC 19.44, RelWithDebInfo, Vulkan SDK 1.4.363.0, NVIDIA GeForce RTX 5060 Ti driver 610.88 / Vulkan 1.4.341), PR head 47aef386f merged onto main (5d74c2723):

  • python -I scripts/check_no_game_data.py runtime/src/vulkan_replay.h runtime/test/replay_cpu_bench.cpp: clean (exit 0).
  • cmake --build runtime/build --target replay_cpu_bench d3d12_depth24_draw_test --parallel: built cleanly.
  • .\runtime\build\replay_cpu_bench.exe: passed (exit 0).
  • LEONIDA_VK_VALIDATION=1 ctest --test-dir runtime/build -R ^d3d12_depth24_draw$ --output-on-failure -V: 1/1 passed (0 failure(s), 0 validation errors).

AI-assisted.

@DrArroway

Copy link
Copy Markdown

Tested 47aef386f on AMD Radeon RX 6900 XT (RADV NAVI21), Mesa 26.3.1-arch3.4 (RADV), CachyOS Linux 7.3.5, GCC 16.2.1: pass.

  • cmake --build runtime/build/linux --parallel: builds all targets cleanly (48/48 updated targets).
  • ctest --test-dir runtime/build/linux -R "replay|vk_command_replay" --output-on-failure: 10/10 passed (vk_command_replay, replay_copy_offset, replay_readback_stages, replay_texture_barrier, replay_clear_gate, replay_write_immediate_predication, replay_uav_clear_offset, replay_query_predication, replay_query_edges, replay_cpu_bench_selftest).

@OliverMarcusson

Copy link
Copy Markdown

Tested 47aef386 (merged cleanly onto main 5d74c272) on NVIDIA GeForce RTX 5070 Ti (driver 621.01, Vulkan 1.4.357), Windows 11 10.0.26200, MSVC 19.44 (RelWithDebInfo, Windows SDK 10.0.26100.0, glslangValidator 16.6.0): pass.

  • replay_cpu_bench.exe: PASS (exit 0; frame: 49394.6 us per ExecuteCommandLists of 37888 commands)
  • ctest -C RelWithDebInfo -R ^(d3d12_draw|d3d12_depth24_draw)$: 2/2 PASS (d3d12_draw 0.32 s, d3d12_depth24_draw 0.35 s)

AI-assisted (Gemini).

@sgonzalez-glitch

Copy link
Copy Markdown

Tested 47aef386f (as part of #9516, #9549, #9614, #9653, #9657, #9660, #9678 and #9689 merged together onto main 5d74c2723) on NVIDIA GeForce RTX 2080, driver 621.24 (32.0.16.2124), Windows 11, MSVC 19.44 RelWithDebInfo: pass.

AI-assisted: yes

@IAmTheSween

Copy link
Copy Markdown

Tested 47aef386f on NVIDIA GeForce RTX 5070 (Blackwell), driver 32.0.16.2114, Windows 11, MSVC 14.44 (VS 2022), RelWithDebInfo: pass. Applied as a patch onto main 5d74c27 (together with #9665, which touches separate files).

All the replay tests pass: vk_command_replay, replay_cpu_bench_selftest, replay_query_*, replay_copy_offset, replay_texture_barrier, replay_clear_gate, replay_readback_stages, replay_uav_clear_offset and replay_write_immediate_predication.

Full ctest: 238/240 pass. The two failures are the ones current main already has on this GPU and are unrelated to this PR: d3d12_vulkan_device at line 6574: tiles == 1 (fixed by #8496) and d3d12_depth_resolve (fixed by #7905). I checked both fixes on this machine; with them applied, main passes 239/239.

AI-assisted run (Claude via OpenCode).

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.

8 participants