Repository navigation
d3d12: use legal Vulkan depth clear values (D3D-CLEAR-DEPTH-RANGE) - #516
Conversation
|
Review of head d336fc9 (read-only; Linux, g++, no GPU, no Windows/MSVC). What ran:
Findings:
Not tested: no build of the shims or Review written by Claude (Claude Code, Opus 5.5), an AI agent, posted from a contributor's account. |
|
Updated the depth-clear notes in 76033b0 to record the documented clamp and measured behavior. On Windows 11 build 26100, native D3D12 on the RTX 5070 Ti (610.74) and WARP agreed bit for bit on all 45 D32_FLOAT texels. This included out-of-range finite values, quiet NaN, and the zero-flags case. Both native paths preserved the raw values in full and rectangle clears. The caller-owned device path uses the capability supplied in VulkanDeviceInfo. The two clear tests exercise it with the extension enabled and disabled, respectively. Both clear tests, vk_command_replay, and d3d12_depth_view_format_support passed again with validation enabled. All fixtures were synthetic. AI-assisted. Rechecked 76033b0 applied to upstream main 21625bc on the same Windows RTX 5070 Ti with Khronos Vulkan validation 1.4.369. Both depth-clear tests, the 251 format comparisons against WARP, and both replay-query tests passed with zero validation errors. The RGB9E5 render-target case skipped because the adapter does not expose RGB9E5 render targets. AI-assisted verification. |
|
Tested 76033b0 (both commits, cherry-picked onto main 1c93c86) together with #540's c9f4a56 on an NVIDIA GeForce RTX 4080 (driver 621.24, Vulkan 1.4.357), Windows 11 Home build 26300, MSVC 14.44 / RelWithDebInfo, built with With Before, on a build of main d42773d: With the three commits: Limits: the two PRs were tested together, not each alone; only these six tests were run, not the whole ctest suite; the before and after builds are 24 commits of main apart. No game files. AI-assisted (Claude Code built, ran the tests and wrote this comment). |
…es (D3D-CLEAR-DEPTH-RANGE) # Conflicts: # runtime/test/vk_test_device.h
|
Tested 76033b0 (cherry-picked onto main 21625bc) on AMD Radeon 660M (RDNA2 iGPU), Adrenalin 32.0.21045.1000, Windows 11 26200: the new |
|
Tested 76033b0 on AMD Radeon RX 7900 XTX (RDNA3, Navi 31), AMD driver 26.11.2 (32.0.32029.2010), Vulkan 1.4.359, Windows 11, Vulkan SDK 1.4.363.0: the validation errors are gone, but
No game files. AI-assisted (Claude Code ran the builds and tests). |
|
Tested commit
The PR is currently marked conflicting with — Codex (tests), posted by Claude |
76033b0 to
86b069f
Compare
|
Merging. Why merged: D3D-CLEAR-DEPTH-RANGE: enables VK_EXT_depth_range_unrestricted where the device has it, so depth clears outside [0,1] (and NaN) behave like D3D12 instead of being clamped. Without the extension it keeps clamping, and NaN becomes 0. Four independent passes; on AMD (660M, 7900 XTX), d3d12_clear still fails only on the NaN rows, which is the driver issue tracked in #307, not this PR. Why it's good: On the 4070 SUPER with validation on, main's d3d12_clear_test exits 1 with 4x VUID-VkClearDepthStencilValue-depth-00022. With this PR it exits 0 with no VUIDs, and the 1.5 / -0.5 / NaN clears match WARP. The new d3d12_clear_restricted_depth passes, and so do d3d12_clear and d3d12_clear_formats. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 3295055, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main 955d9be. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main 71f99e2: no conflicts, and none of these touch the files #891/#882 changed. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5). |
Merging. **Why merged:** VK-SAMPLER-UNNORM-BIAS: an unnormalized-coordinates sampler gets mipLodBias 0, which VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01074 requires. kawaii-shakal ran it under ASan/UBSan and showed the new check fails on main. **Why it's good:** gfx10_descriptors and d3d12_descriptor pass both plain and under validation. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 3295055, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main 955d9be. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main 71f99e2: no conflicts, and none of these touch the files #891/#882 changed. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
…opy-clear-stage Merging. **Why merged:** OLD-10048: SYNC_COPY maps to COPY|CLEAR, so WriteBufferImmediate (vkCmdUpdateBuffer) and the query zero-fill are ordered before later copies. moffington reproduced the read-after-write hazard on the base, and Timon360SB and SweatierKey checked it independently. Part K of vk_command_replay_test covers it. **Why it's good:** vk_command_replay, d3d12_state_map and replay_query_edges pass both plain and under validation. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 3295055, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main 955d9be. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main 71f99e2: no conflicts, and none of these touch the files #891/#882 changed. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
…dup-wait Merging. **Why merged:** RT-RETIRE-TICKETS-DEDUP-WAIT: pending_through() merges entries per semaphore to the highest value, and completed_ can no longer move backwards. moffington (ASan/UBSan, with a differential test that fails on the base), Timon360SB, KernelSmoker and SweatierKey checked it independently. **Why it's good:** retire_tickets passes both plain and under validation. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 3295055, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main 955d9be. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main 71f99e2: no conflicts, and none of these touch the files #891/#882 changed. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
|
For the developer role on the project Discord: my Discord username is sodove. |
Claimed in the coordination issue as: D3D-CLEAR-DEPTH-RANGE (#14)
What and why
This addresses the depth-clear half of #506. Both full and rectangle clears currently pass unrestricted float depth values to Vulkan on devices that did not enable VK_EXT_depth_range_unrestricted, triggering VUID-VkClearDepthStencilValue-depth-00022.
Enable the extension on standalone devices that advertise it and carry the enabled capability through caller-owned device info to replay. With the extension, float depth clears can preserve the requested value. Without it, replay clamps depth to [0, 1] and uses 0 for NaN. The existing D16 and emulated D24 conversions still apply. The new restricted-depth CTest covers a device created without the extension even on hardware that supports it.
The edge-value test overlaps with #307, which addresses AMD drivers that canonicalize NaN. The mesh query issue in #506 is separate.
Tested
Windows 11 26100.7623, MSVC 19.44.35220 Release, Vulkan validation layer 1.4.369 with LEONIDA_VK_VALIDATION=1.
GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 610.74, Windows 11.
AI-assisted: yes (OpenAI Codex).
Checklist