vulkan: the depth24 conversion keeps its shader barriers on a copy queue (RT-DEPTH24-COPY-QUEUE-BARRIERS) #2469

Closed
leonida/mandy
Tyrannys wants to merge 0 commits from rt-depth24-copy-queue-barriers into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

Tyrannys commented 2026-11-27 14:40:25 +00:00

Claimed in the coordination issue as: RT-DEPTH24-COPY-QUEUE-BARRIERS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7215741391)

What and why

Found by @kevincommits in #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7208331179), thanks for the precise write-up.

A D3D12 copy queue whose Vulkan family can run compute also runs the depth24/rgb96 footprint conversion: depth24_prepare is installed whenever the family is not the transfer-only one. But that queue's replay uses queue_stages_copy, which has no COMPUTE_SHADER bit, so:

  • detail::restrict_to_queue zeroed the shader access of the four barriers around run_depth24 (dstAccessMask = 0 before the dispatch, srcAccessMask = 0 after it). The copy's writes were not made visible to the shader, nor the shader's writes to the copy or readback that follows.
  • The host-readback barrier masked COMPUTE_SHADER away and fell back to TRANSFER / TRANSFER_WRITE -> HOST, so the conversion's writes were not made available to the host.

This keeps the copy-queue conversion (which depth24_convert_test exercises) and fixes its barriers:

  • New detail::depth24_barrier: the barriers around the conversion's dispatch are restricted to the queue's stages plus COMPUTE_SHADER, the stage the dispatch already uses on that queue. restrict_to_queue and memory_barrier now go through restrict_to_stages / memory_barrier_within; every other barrier is unchanged.
  • The host-readback barrier in VulkanQueue allows COMPUTE_SHADER where depth24_prepare is installed.
  • queue_stages itself is unchanged, so the other compute paths stay refused on a copy queue.
  • A transfer-only family never runs the conversion (@timbot103's review). execute_now() copies context_.replay_, so it now clears the depth24_prepare / depth24_run callbacks that enable_depth24() put there, and such a copy is refused as unsupported. The D3D12 device now registers a copy family without compute as transfer-only on every device; before, it did so only with conditional rendering.

depth24_convert_test now watches vkCmdPipelineBarrier through the context's device proc. On direct, compute and copy queues, the depth24 and rgb96 readbacks must have a barrier into the shader's reads and one out of its writes, and the host barrier must come from COMPUTE_SHADER / MEMORY_WRITE. The old test asserted the TRANSFER fallback on a copy queue; that assertion is replaced.

Staying apart from #1988 (Depth24Converter bounds); no shared files.

Tested

Windows 11, MSVC (VS 18), Vulkan SDK 1.4.341, RelWithDebInfo, on this branch merged with main (ec91d695c).

  • Review fix (26fd3b3bb): depth24_convert_test registers the test's family as transfer-only and checks that depth24 and rgb96 uploads and readbacks on a copy queue return unsupported with no conversion or host barriers; with the previous vulkan_backend.h it fails at that check (line 705). It also checks the conversion barriers of buffer-to-image uploads on every queue kind (@lixonik's note). depth24_convert, depth24_fragment, d3d12_d24_support, d3d12_depth24_draw, xbox_d16s8_d24_storage: pass; depth24_convert also with LEONIDA_VK_VALIDATION=1, no messages.
  • depth24_convert: passes, also with LEONIDA_VK_VALIDATION=1 (validation and sync validation on, no messages).
  • Negative control, new test against main's vulkan_backend.h and vulkan_replay.h: fails at to_shader_barriers >= 1 && from_shader_barriers >= 1 (the conversion's barriers lose their shader access). With only the replay half of the fix, it fails at host_src_stages == VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT (the host barrier). Both halves are needed.
  • Sync validation on SDK 1.4.341 does not flag main here either, matching @kevincommits' note that 1.4.363 no longer flags it; the barrier check in the test is what catches it.
  • Related ctests (vk_*, depth24*, replay_*, d3d12_queue*, d3d12_*copy*, predicated_copy, guarded_copy, queue_proxy, xbox_present_readback_size), 84 tests: all pass except
    • d3d12_queue_handover, _two_queues, _shared_queue: failed only under ctest -j 4 load; pass when run alone.
    • vk_compile_gate_calibration: "no verdict on NVIDIA (unclear)" under load; passes alone (3/3).
    • vk_sync_validation: skipped.
  • vk_*, depth24*, replay_* with LEONIDA_VK_VALIDATION=1 (58 tests): all pass except vk_device_markers, which fails the same way on main (sync validation WRITE_AFTER_WRITE between two vkCmdWriteBufferMarker2AMD writes); unrelated to this change.

GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

Claimed in the coordination issue as: RT-DEPTH24-COPY-QUEUE-BARRIERS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7215741391) ### What and why Found by @kevincommits in #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7208331179), thanks for the precise write-up. A D3D12 copy queue whose Vulkan family can run compute also runs the depth24/rgb96 footprint conversion: `depth24_prepare` is installed whenever the family is not the transfer-only one. But that queue's replay uses `queue_stages_copy`, which has no `COMPUTE_SHADER` bit, so: - `detail::restrict_to_queue` zeroed the shader access of the four barriers around `run_depth24` (`dstAccessMask = 0` before the dispatch, `srcAccessMask = 0` after it). The copy's writes were not made visible to the shader, nor the shader's writes to the copy or readback that follows. - The host-readback barrier masked `COMPUTE_SHADER` away and fell back to `TRANSFER / TRANSFER_WRITE -> HOST`, so the conversion's writes were not made available to the host. This keeps the copy-queue conversion (which `depth24_convert_test` exercises) and fixes its barriers: - New `detail::depth24_barrier`: the barriers around the conversion's dispatch are restricted to the queue's stages plus `COMPUTE_SHADER`, the stage the dispatch already uses on that queue. `restrict_to_queue` and `memory_barrier` now go through `restrict_to_stages` / `memory_barrier_within`; every other barrier is unchanged. - The host-readback barrier in `VulkanQueue` allows `COMPUTE_SHADER` where `depth24_prepare` is installed. - `queue_stages` itself is unchanged, so the other compute paths stay refused on a copy queue. - A transfer-only family never runs the conversion (@timbot103's review). `execute_now()` copies `context_.replay_`, so it now clears the `depth24_prepare` / `depth24_run` callbacks that `enable_depth24()` put there, and such a copy is refused as unsupported. The D3D12 device now registers a copy family without compute as transfer-only on every device; before, it did so only with conditional rendering. `depth24_convert_test` now watches `vkCmdPipelineBarrier` through the context's device proc. On direct, compute and copy queues, the depth24 and rgb96 readbacks must have a barrier into the shader's reads and one out of its writes, and the host barrier must come from `COMPUTE_SHADER / MEMORY_WRITE`. The old test asserted the `TRANSFER` fallback on a copy queue; that assertion is replaced. Staying apart from #1988 (Depth24Converter bounds); no shared files. ### Tested Windows 11, MSVC (VS 18), Vulkan SDK 1.4.341, RelWithDebInfo, on this branch merged with `main` (`ec91d695c`). - Review fix (26fd3b3bb): `depth24_convert_test` registers the test's family as transfer-only and checks that depth24 and rgb96 uploads and readbacks on a copy queue return `unsupported` with no conversion or host barriers; with the previous `vulkan_backend.h` it fails at that check (line 705). It also checks the conversion barriers of buffer-to-image uploads on every queue kind (@lixonik's note). `depth24_convert`, `depth24_fragment`, `d3d12_d24_support`, `d3d12_depth24_draw`, `xbox_d16s8_d24_storage`: pass; `depth24_convert` also with `LEONIDA_VK_VALIDATION=1`, no messages. - `depth24_convert`: passes, also with `LEONIDA_VK_VALIDATION=1` (validation and sync validation on, no messages). - Negative control, new test against `main`'s `vulkan_backend.h` and `vulkan_replay.h`: fails at `to_shader_barriers >= 1 && from_shader_barriers >= 1` (the conversion's barriers lose their shader access). With only the replay half of the fix, it fails at `host_src_stages == VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT` (the host barrier). Both halves are needed. - Sync validation on SDK 1.4.341 does not flag `main` here either, matching @kevincommits' note that 1.4.363 no longer flags it; the barrier check in the test is what catches it. - Related ctests (`vk_*`, `depth24*`, `replay_*`, `d3d12_queue*`, `d3d12_*copy*`, `predicated_copy`, `guarded_copy`, `queue_proxy`, `xbox_present_readback_size`), 84 tests: all pass except - `d3d12_queue_handover`, `_two_queues`, `_shared_queue`: failed only under `ctest -j 4` load; pass when run alone. - `vk_compile_gate_calibration`: "no verdict on NVIDIA (unclear)" under load; passes alone (3/3). - `vk_sync_validation`: skipped. - `vk_*`, `depth24*`, `replay_*` with `LEONIDA_VK_VALIDATION=1` (58 tests): all pass except `vk_device_markers`, which fails the same way on `main` (sync validation `WRITE_AFTER_WRITE` between two `vkCmdWriteBufferMarker2AMD` writes); unrelated to this change. GPUs tested: profile M: NVIDIA GeForce RTX 4070 SUPER, 12 GB, desktop, driver 621.01, Windows 11 AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
lixonik reviewed 2026-11-27 15:20:38 +00:00
lixonik left a comment
No description provided.
Reviewed and tested at `0e204a9ab` (merged cleanly onto `main` `ec91d695c`). Clean, targeted fix: - Confirmed `replay.depth24_prepare` is only installed when `!transfer_only` (`runtime/src/vulkan_backend.h:3388`), so adding `VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT` to `allowed` for host-readback visibility on copy queues is safe even on GPUs with a dedicated transfer-only queue family. - Confirmed `copy_depth_uav()` (`runtime/src/vulkan_replay.h:3536`) already refuses queues whose `vk.queue_stages` omits `COMPUTE_SHADER_BIT`, so the four `CopyTextureRegion` depth24/rgb96 barriers updated to `depth24_barrier()` are the only ones reachable on a copy queue. - Minor test-coverage note: `watch_dispatch_barriers` in `depth24_convert_test.cpp` currently checks the image-->buffer readback dispatches on a copy queue; asserting `to_shader_barriers` / `from_shader_barriers` on a buffer-->image upload on a copy queue too would cover both halves of the `vulkan_replay.h` change. Verified locally on Windows 11 (MSVC 19.44.35230.0, Ninja Release, NVIDIA GeForce RTX 5070, driver 610.88, Vulkan 1.4.341; note `VK_LAYER_KHRONOS_validation` is not installed locally so Vulkan validation layers did not run): - `depth24_convert` (GPU): passed (all 10 sub-checks including the new copy-queue shader barrier and host-readback visibility assertions) - `scripts/check_no_game_data.py` and `git diff --check`: clean No blocking findings. AI-assisted.
djrolfes commented 2026-11-27 15:26:28 +00:00

Independent Linux/Wine + NVIDIA check at head 0e204a9ab (merged cleanly onto origin/main ec91d695c in a local integration stack alongside #2467, #2463, #2470, #2461, #2126, #2091, and two local V# patches).

  • Environment: Linux 7.2.15, wine-11.22, clang-cl + xwin cross-build, NVIDIA GeForce RTX 3070 Ti 8 GB, driver 620.73.04, Ryzen 7 5800X, 32 GB RAM. No game files.
  • CTest: depth24_convert passed (14.66 s) on RTX 3070 Ti under Wine (all 10 checks including host-readback visibility barriers, shared-buffer offsets, and concurrent VulkanQueue::execute).
  • Code review: depth24_barrier cleanly preserves VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT for copy queues running on compute-capable families without widening unrelated transfer barriers.

AI-assisted.

Independent Linux/Wine + NVIDIA check at head `0e204a9ab` (merged cleanly onto `origin/main` `ec91d695c` in a local integration stack alongside `#2467`, `#2463`, `#2470`, `#2461`, `#2126`, `#2091`, and two local V# patches). - **Environment:** Linux `7.2.15`, `wine-11.22`, `clang-cl` + `xwin` cross-build, NVIDIA GeForce RTX 3070 Ti 8 GB, driver `620.73.04`, Ryzen 7 5800X, 32 GB RAM. No game files. - **CTest:** `depth24_convert` **passed** (`14.66 s`) on RTX 3070 Ti under Wine (all 10 checks including host-readback visibility barriers, shared-buffer offsets, and concurrent `VulkanQueue::execute`). - **Code review:** `depth24_barrier` cleanly preserves `VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT` for copy queues running on compute-capable families without widening unrelated transfer barriers. AI-assisted.
Tauwni commented 2026-11-27 16:17:46 +00:00

Tested on a Mac under Wine. On Macs every D24 depth target takes this conversion path: neither MoltenVK nor KosmicKrisp has D24_UNORM_S8_UINT, so it's D32 there.

Tree depth24_convert d3d12_d24_support d3d12_depth24_draw
main pass pass pass
this PR's depth24_convert_test.cpp on main, no fix fail: line 635: to_shader_barriers >= 1 && from_shader_barriers >= 1 pass pass
main + this PR pass pass pass

GPUs tested: Apple M3 (profile S), macOS 26.5.1, Wine 11.0 (WineHQ macOS build) with its MoltenVK 1.4.1, clang-cl/lld-link 23.1.6 cross build, main ec91d695c. No game files. MEASURED, 1 run each.

AI-assisted (Claude Code, Claude Opus 5.5).

Tested on a Mac under Wine. On Macs every D24 depth target takes this conversion path: neither MoltenVK nor KosmicKrisp has `D24_UNORM_S8_UINT`, so it's D32 there. | Tree | `depth24_convert` | `d3d12_d24_support` | `d3d12_depth24_draw` | |---|---|---|---| | `main` | pass | pass | pass | | this PR's `depth24_convert_test.cpp` on `main`, no fix | **fail**: `line 635: to_shader_barriers >= 1 && from_shader_barriers >= 1` | pass | pass | | `main` + this PR | pass | pass | pass | GPUs tested: Apple M3 (profile S), macOS 26.5.1, Wine 11.0 (WineHQ macOS build) with its MoltenVK 1.4.1, clang-cl/lld-link 23.1.6 cross build, `main` `ec91d695c`. No game files. MEASURED, 1 run each. AI-assisted (Claude Code, Claude Opus 5.5).
timbot103 commented 2026-11-28 02:02:28 +00:00

Reviewed at head 0e204a9ab on Windows 11 (MSVC 2022 19.44) with dual-GPU Vulkan validation (LEONIDA_VK_VALIDATION=1, Vulkan SDK 1.4.363.0).

Verification

  • Built depth24_convert_test.
  • depth24_convert_test (LEONIDA_VK_VALIDATION=1): ok with 0 validation errors on both NVIDIA GeForce RTX 5080 (616.64) and AMD Radeon(TM) Graphics (25.10.30.02).

Finding (Request changes)

  • A real transfer-only queue family can still inherit depth24/RGB96 converter callbacks and emit illegal COMPUTE_SHADER barriers (vulkan_backend.h:3267-3270, 3388-3399; d3d12_vulkan_device.cpp:14973-14992):
    1. enable_depth24() installs converter callbacks directly on context_.replay_. In execute_now(), replay = context_.replay_ copies that table, and on a transfer_only family the later conditional skips wrapping prepare_depth24 rather than clearing both inherited callbacks — leaving them callable on a transfer-only family.
    2. In d3d12_vulkan_device.cpp:14973-14992, the only production call to set_transfer_only_family(info.copy_family) is nested inside if (info.conditional_rendering), so on devices without conditional rendering the transfer-only family is never registered at all.
      In either case, an aligned RGB96 copy on a DMA-only family can enter the converter and emit the new VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT legacy and sync2 barriers (vulkan_replay.h:1845-1853, 5132-5141, 5169-5184), violating VUID-vkCmdPipelineBarrier-dstStageMask-06462, srcStageMask-06461, and VUID-vkCmdPipelineBarrier2-srcStageMask-09673 (in addition to binding/dispatching compute on a transfer-only queue). Registering transfer-only families independently of conditional_rendering and explicitly clearing inherited depth24 callbacks on transfer-only queues closes both paths cleanly.

On compute-capable copy queues, the new converter barriers look well-scoped and ordinary copies keep their transfer-stage filter.

AI-assisted review + local MSVC/dual-GPU verification.

Reviewed at head `0e204a9ab` on Windows 11 (MSVC 2022 `19.44`) with dual-GPU Vulkan validation (`LEONIDA_VK_VALIDATION=1`, Vulkan SDK `1.4.363.0`). ### Verification - Built `depth24_convert_test`. - `depth24_convert_test` (`LEONIDA_VK_VALIDATION=1`): **ok** with 0 validation errors on both **NVIDIA GeForce RTX 5080** (`616.64`) and **AMD Radeon(TM) Graphics** (`25.10.30.02`). ### Finding (Request changes) - **A real transfer-only queue family can still inherit depth24/RGB96 converter callbacks and emit illegal `COMPUTE_SHADER` barriers (`vulkan_backend.h:3267-3270`, `3388-3399`; `d3d12_vulkan_device.cpp:14973-14992`):** 1. `enable_depth24()` installs converter callbacks directly on `context_.replay_`. In `execute_now()`, `replay = context_.replay_` copies that table, and on a `transfer_only` family the later conditional skips wrapping `prepare_depth24` rather than clearing both inherited callbacks — leaving them callable on a transfer-only family. 2. In `d3d12_vulkan_device.cpp:14973-14992`, the only production call to `set_transfer_only_family(info.copy_family)` is nested inside `if (info.conditional_rendering)`, so on devices without conditional rendering the transfer-only family is never registered at all. In either case, an aligned RGB96 copy on a DMA-only family can enter the converter and emit the new `VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT` legacy and sync2 barriers (`vulkan_replay.h:1845-1853`, `5132-5141`, `5169-5184`), violating **`VUID-vkCmdPipelineBarrier-dstStageMask-06462`**, **`srcStageMask-06461`**, and **`VUID-vkCmdPipelineBarrier2-srcStageMask-09673`** (in addition to binding/dispatching compute on a transfer-only queue). Registering transfer-only families independently of `conditional_rendering` and explicitly clearing inherited depth24 callbacks on transfer-only queues closes both paths cleanly. On compute-capable copy queues, the new converter barriers look well-scoped and ordinary copies keep their transfer-stage filter. AI-assisted review + local MSVC/dual-GPU verification.
Tyrannys commented 2026-11-28 13:06:31 +00:00

@timbot103 thanks, both paths were real. Fixed in 26fd3b3bb.

  1. Inherited callbacks. execute_now() copies context_.replay_, and on a transfer-only family it only skipped the wrapper, so depth24_prepare/depth24_run from enable_depth24() stayed callable. Both are now cleared on a transfer-only family (vulkan_backend.h), so a depth24 or rgb96 copy there is refused as unsupported before anything is recorded: no dispatch and no COMPUTE_SHADER barrier.
  2. Registration. d3d12_vulkan_device.cpp now registers a copy family without VK_QUEUE_COMPUTE_BIT as transfer-only on every device. Only the predication setup stays behind info.conditional_rendering.

Test, depth24_convert_test: the test's family is registered as transfer-only (set_transfer_only_family), and on a copy queue the depth24 and rgb96 uploads and readbacks are each checked to return unsupported with no conversion barriers (shader stage, either direction) and no host-readback barrier. With the previous commit's vulkan_backend.h, it fails at that check (line 705). With the fix it passes.

@lixonik's coverage note is in the same commit: on direct, compute and copy queues, depth24 and rgb96 buffer-to-image uploads now also check to_shader_barriers / from_shader_barriers.

Windows 11, MSVC (VS 18), RelWithDebInfo, RTX 4070 SUPER (driver 621.01):

  • depth24_convert: passes, also with LEONIDA_VK_VALIDATION=1 (no validation messages).
  • depth24_fragment, d3d12_d24_support, d3d12_depth24_draw: pass.
  • xbox_d16s8_d24_storage: passed 5 of 5 when run alone. It timed out once when run in the same ctest batch as the other depth24 tests, so that looks like load. I have not reproduced it.
  • scripts/check_no_game_data.py, git diff --check: clean. The branch still merges cleanly with main.

AI-assisted (Claude Code)

@timbot103 thanks, both paths were real. Fixed in 26fd3b3bb. 1. **Inherited callbacks.** `execute_now()` copies `context_.replay_`, and on a transfer-only family it only skipped the wrapper, so `depth24_prepare`/`depth24_run` from `enable_depth24()` stayed callable. Both are now cleared on a transfer-only family (`vulkan_backend.h`), so a depth24 or rgb96 copy there is refused as unsupported before anything is recorded: no dispatch and no `COMPUTE_SHADER` barrier. 2. **Registration.** `d3d12_vulkan_device.cpp` now registers a copy family without `VK_QUEUE_COMPUTE_BIT` as transfer-only on every device. Only the predication setup stays behind `info.conditional_rendering`. Test, `depth24_convert_test`: the test's family is registered as transfer-only (`set_transfer_only_family`), and on a copy queue the depth24 and rgb96 uploads and readbacks are each checked to return `unsupported` with no conversion barriers (shader stage, either direction) and no host-readback barrier. With the previous commit's `vulkan_backend.h`, it fails at that check (`line 705`). With the fix it passes. @lixonik's coverage note is in the same commit: on direct, compute and copy queues, depth24 and rgb96 buffer-to-image uploads now also check `to_shader_barriers` / `from_shader_barriers`. Windows 11, MSVC (VS 18), RelWithDebInfo, RTX 4070 SUPER (driver 621.01): - `depth24_convert`: passes, also with `LEONIDA_VK_VALIDATION=1` (no validation messages). - `depth24_fragment`, `d3d12_d24_support`, `d3d12_depth24_draw`: pass. - `xbox_d16s8_d24_storage`: passed 5 of 5 when run alone. It timed out once when run in the same ctest batch as the other depth24 tests, so that looks like load. I have not reproduced it. - `scripts/check_no_game_data.py`, `git diff --check`: clean. The branch still merges cleanly with `main`. AI-assisted (Claude Code)
lixonik approved these changes 2026-11-28 13:43:09 +00:00
lixonik left a comment

Re-reviewed 26fd3b3bb and tested on RTX 5070 with Khronos validation enabled.

Code audit:

  • runtime/src/vulkan_backend.h: explicitly clearing inherited replay.depth24_prepare and replay.depth24_run callbacks on transfer_only families ensures a transfer-only copy queue refuses depth24/RGB96 conversion as unsupported without dispatching compute or emitting COMPUTE_SHADER barriers.
  • runtime/shims/d3d12_vulkan_device.cpp: registering a non-compute copy family via set_transfer_only_family(info.copy_family) unconditionally (outside if (info.conditional_rendering)) closes the remaining registration gap.
  • runtime/test/depth24_convert_test.cpp: covers both transfer-only refusal and buffer-to-image upload to_shader_barriers/from_shader_barriers checks across direct, compute, and copy queues.

Verification at 26fd3b3bb (Windows 11, MSVC 19.44, Ninja Release, LEONIDA_VK_VALIDATION=1):

  • Built depth24_convert_test, depth24_fragment_test, d3d12_d24_support_test, and d3d12_depth24_draw_test.
  • ctest -R '^(depth24_convert|depth24_fragment|d3d12_d24_support|d3d12_depth24_draw)$': 4/4 passed (0 validation errors).
  • python -I scripts/check_no_game_data.py: passed.

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, VK_LAYER_KHRONOS_validation 1.4.363).

AI-assisted (Antigravity, Gemini).

Re-reviewed `26fd3b3bb` and tested on RTX 5070 with Khronos validation enabled. Code audit: - `runtime/src/vulkan_backend.h`: explicitly clearing inherited `replay.depth24_prepare` and `replay.depth24_run` callbacks on `transfer_only` families ensures a transfer-only copy queue refuses depth24/RGB96 conversion as unsupported without dispatching compute or emitting `COMPUTE_SHADER` barriers. - `runtime/shims/d3d12_vulkan_device.cpp`: registering a non-compute copy family via `set_transfer_only_family(info.copy_family)` unconditionally (outside `if (info.conditional_rendering)`) closes the remaining registration gap. - `runtime/test/depth24_convert_test.cpp`: covers both transfer-only refusal and buffer-to-image upload `to_shader_barriers`/`from_shader_barriers` checks across direct, compute, and copy queues. Verification at `26fd3b3bb` (Windows 11, MSVC 19.44, Ninja Release, `LEONIDA_VK_VALIDATION=1`): - Built `depth24_convert_test`, `depth24_fragment_test`, `d3d12_d24_support_test`, and `d3d12_depth24_draw_test`. - `ctest -R '^(depth24_convert|depth24_fragment|d3d12_d24_support|d3d12_depth24_draw)$'`: **4/4 passed** (0 validation errors). - `python -I scripts/check_no_game_data.py`: passed. GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341, `VK_LAYER_KHRONOS_validation` 1.4.363). AI-assisted (Antigravity, Gemini).
zmasi commented 2026-11-28 20:36:27 +00:00

Verified 26fd3b3bb merged with main 1bc055e6c on physical gfx906, native subgroup 64, RADV Mesa 26.0.8 with synchronization validation. The same depth24_convert_test source failed on main and passed on the merge. Main stripped the compute-stage destination access to zero on a logical copy queue backed by a compute-capable family. A test observer captured that submission and stopped it before it reached the driver; this is a barrier failure, not evidence of corrupt pixels.

On the merge, D24 and RGB96 conversions retained compute shader read/write access, and the readback barrier made compute writes visible to the host. All 1,995 scoped readback words matched the independent oracle, including 256 D24 and 153 RGB96 words on the copy queue. All 1,586 words from legally submitted main controls also matched. No validation errors, synchronization hazards or physical device loss. This device advertised no transfer-only family: the four transfer-only refusals were checked by marking the test family transfer-only, not by submitting to a dedicated DMA engine.

AI-assisted.

Verified `26fd3b3bb` merged with main `1bc055e6c` on physical gfx906, native subgroup 64, RADV Mesa 26.0.8 with synchronization validation. The same `depth24_convert_test` source failed on main and passed on the merge. Main stripped the compute-stage destination access to zero on a logical copy queue backed by a compute-capable family. A test observer captured that submission and stopped it before it reached the driver; this is a barrier failure, not evidence of corrupt pixels. On the merge, D24 and RGB96 conversions retained compute shader read/write access, and the readback barrier made compute writes visible to the host. All 1,995 scoped readback words matched the independent oracle, including 256 D24 and 153 RGB96 words on the copy queue. All 1,586 words from legally submitted main controls also matched. No validation errors, synchronization hazards or physical device loss. This device advertised no transfer-only family: the four transfer-only refusals were checked by marking the test family transfer-only, not by submitting to a dedicated DMA engine. AI-assisted.
timbot103 reviewed 2026-11-29 04:27:23 +00:00
timbot103 left a comment
No description provided.
Static audit of `26fd3b3bb` only, with no builds, tests, or GPU runs. On a graphics+compute family, the legacy barriers now preserve shader reads and writes around the scratch-buffer conversion. The host barrier covers compute writes through synchronization2 and through the legacy `ALL_COMMANDS / MEMORY_WRITE` path. Clearing the callbacks also correctly refuses the conversion on the registered DMA family. - **[MAJOR] `runtime/shims/d3d12_vulkan_device.cpp:14987`** — This check covers the dedicated copy family. The queue picker can select a graphics family without compute at `runtime/shims/d3d12_vulkan_device.cpp:22007`, and a copy queue can fall back to it. An RGB96 footprint copy on that queue still dispatches compute and now records explicit compute-stage barriers, violating the queue-family stage requirements in `VUID-vkCmdPipelineBarrier-srcStageMask-06461` and `VUID-vkCmdPipelineBarrier-dstStageMask-06462`. A host-readable readback through synchronization2 also violates `VUID-vkCmdPipelineBarrier2-srcStageMask-09673`. Gate the converter callbacks and host compute barrier on the capabilities of the actual queue family. - **[MAJOR] `runtime/src/vulkan_replay.h:5152`** — With no suitable DMA family, the picker can lease a copy queue from a compute-only family. That family can run the conversion shader, but the D24-as-D32 upload here and the readback at `runtime/src/vulkan_replay.h:5175` also issue depth-aspect buffer/image copies. Those commands require `maintenance10` and the depth-copy format feature on that family. Please check both before preparing the conversion and refuse the copy when either is missing. The existing per-format capability check in `runtime/src/vulkan_replay.h:3529` provides a starting point. The upload and readback assertions in `runtime/test/depth24_convert_test.cpp:623` all reuse the same graphics family. The refusal check at `runtime/test/depth24_convert_test.cpp:697` simulates DMA by registering that family as transfer-only. Coverage of a non-graphics compute family would catch the depth-aspect copy failure. AI-assisted.
enlight3d commented 2026-11-29 15:29:51 +00:00

Run on 26fd3b3bb (PR head), merged locally with main 50d09b373. Prep notes by TheGeogeo's review session.

  • Merge: clean (git merge --no-ff pr-2469, auto-merged d3d12_vulkan_device.cpp, vulkan_backend.h, vulkan_replay.h). Merged commit 00da55bcd, local only.
  • Build: cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON, then cmake --build build --target depth24_convert_test depth24_fragment_test d3d12_d24_support_test d3d12_depth24_draw_test xbox_depth_storage_test gta6rt -j 6.

Green (merged build)

  • ctest -R "^(depth24_convert|depth24_fragment|d3d12_d24_support|d3d12_depth24_draw|xbox_d16s8_d24_storage)$" --output-on-failure -j1: 5/5 passed (depth24_convert 7.1 s, actually run, not skipped).
  • depth24_convert_test with LEONIDA_VK_VALIDATION=1 (validation on): exit 0, no validation or sync-validation messages.

Red (behavioural: the test is kept and compiles against main's sources; the three non-test files are reverted to main)

  • Reverted d3d12_vulkan_device.cpp, vulkan_backend.h, vulkan_replay.h: depth24_convert fails at depth24_convert_test.cpp line 637 to_shader_barriers >= 1 && from_shader_barriers >= 1 (the conversion's barriers lose their shader access). It fails the same way with LEONIDA_VK_VALIDATION=1; validation itself printed nothing, so on this GPU and SDK the barrier counter is what catches it, not sync validation.
  • Only vulkan_replay.h from the PR (backend and device from main): fails at line 652 host_src_stages == VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT (host barrier).
  • Only vulkan_backend.h and d3d12_vulkan_device.cpp from the PR (replay from main): fails at line 637 again.
  • So both halves of the fix are needed, as the description says. Not run: the RADV plus sync-validation red from the notes (no AMD GPU here), and timbot103's open point (graphics-without-compute and compute-only copy families), which needs such a queue family.

Link: gta6rt.exe of the merged build: no new imports vs main (703 imports, identical lists with dumpbin /imports).

Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, Vulkan SDK 1.4.363.1. One run each.

AI-assisted (Claude Code).

Run on `26fd3b3bb` (PR head), merged locally with `main` `50d09b373`. Prep notes by TheGeogeo's review session. - **Merge:** clean (`git merge --no-ff pr-2469`, auto-merged `d3d12_vulkan_device.cpp`, `vulkan_backend.h`, `vulkan_replay.h`). Merged commit `00da55bcd`, local only. - **Build:** `cmake -S runtime -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON`, then `cmake --build build --target depth24_convert_test depth24_fragment_test d3d12_d24_support_test d3d12_depth24_draw_test xbox_depth_storage_test gta6rt -j 6`. **Green (merged build)** - `ctest -R "^(depth24_convert|depth24_fragment|d3d12_d24_support|d3d12_depth24_draw|xbox_d16s8_d24_storage)$" --output-on-failure -j1`: 5/5 passed (`depth24_convert` 7.1 s, actually run, not skipped). - `depth24_convert_test` with `LEONIDA_VK_VALIDATION=1` (validation on): exit 0, no validation or sync-validation messages. **Red (behavioural: the test is kept and compiles against `main`'s sources; the three non-test files are reverted to `main`)** - Reverted `d3d12_vulkan_device.cpp`, `vulkan_backend.h`, `vulkan_replay.h`: `depth24_convert` fails at `depth24_convert_test.cpp` line 637 `to_shader_barriers >= 1 && from_shader_barriers >= 1` (the conversion's barriers lose their shader access). It fails the same way with `LEONIDA_VK_VALIDATION=1`; validation itself printed nothing, so on this GPU and SDK the barrier counter is what catches it, not sync validation. - Only `vulkan_replay.h` from the PR (backend and device from `main`): fails at line 652 `host_src_stages == VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT` (host barrier). - Only `vulkan_backend.h` and `d3d12_vulkan_device.cpp` from the PR (replay from `main`): fails at line 637 again. - So both halves of the fix are needed, as the description says. Not run: the RADV plus sync-validation red from the notes (no AMD GPU here), and timbot103's open point (graphics-without-compute and compute-only copy families), which needs such a queue family. **Link:** gta6rt.exe of the merged build: no new imports vs main (703 imports, identical lists with `dumpbin /imports`). **Machine:** RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, Vulkan SDK 1.4.363.1. One run each. AI-assisted (Claude Code).
aslan2142 commented 2026-12-01 16:44:54 +00:00

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No description provided.