RT-STATE-AUDIT-FORMATS: honor D3D12_DSV_FLAG_READ_ONLY_DEPTH and READ_ONLY_STENCIL #2480

Closed
lixonik wants to merge 10 commits from upstream-pr/2480 into main
lixonik commented 2026-11-27 16:31:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T16:31:10Z.


Part of RT-STATE-AUDIT-FORMATS (#2464; based on the format-state audit notes in #1608 by @kevincommits and @Tauwni).

Summary

  • Store validated DSV read-only flags (dsv_read_only_depth, dsv_read_only_stencil) on TargetView (runtime/src/command_list.h; sizeof(TargetView) == 32 <= kDescriptorSize).
  • Validate desc->Flags in CreateDepthStencilView (runtime/shims/d3d12_vulkan_device.cpp), rejecting unknown flag bits and recording D3D12_DSV_FLAG_READ_ONLY_DEPTH / D3D12_DSV_FLAG_READ_ONLY_STENCIL.
  • Replay read-only depth/stencil attachments properly in runtime/src/vulkan_replay.h:
    • Separate VkRenderingAttachmentInfo for depth and stencil with VK_ATTACHMENT_STORE_OP_NONE, read-only access masks (VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT), and per-aspect read-only layouts when separate_depth_stencil_layouts is enabled (or DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL / DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL when coupled).
    • Use VK_IMAGE_LAYOUT_GENERAL for read-only depth/stencil with bindless sampling where the Vulkan attachment access rules allow it. Simultaneous sampling of one aspect of a packed depth/stencil image while storing the sibling on devices without separateDepthStencilAttachmentAccess remains open. When the sampled aspect entered the draw in GENERAL, replay restores that layout for subsequent reads after the attachment scope ends. See the review.
    • Skip redundant intra-layout memory barriers for read-only attachments and mask out read-only aspects in ClearDepthStencil.
    • Add GraphicsPipeline::read_only_depth / read_only_stencil variant bits (runtime/src/vulkan_replay.h, runtime/shims/d3d12_vulkan_device.cpp) so pipelines with DepthWriteMask = ALL or nonzero stencil write masks suppress writes cleanly when drawn against a read-only DSV (no variant is built when the PSO already disables writes).

Tests

  • runtime/test/d3d12_dsv_readonly_test.cpp (d3d12_dsv_readonly, skips with 77 if no Vulkan GPU): exercises unknown-flag rejection, mixed READ_ONLY_DEPTH + writable stencil, mixed writable depth + READ_ONLY_STENCIL, READ_ONLY_DEPTH | READ_ONLY_STENCIL, read-only ClearDepthStencilView masking, and D32_FLOAT READ_ONLY_DEPTH on GPU.
  • runtime/test/dsv_readonly_replay_test.cpp (dsv_readonly_replay, CPU-only, no GPU required): verifies attachment layouts, storeOp, barrier access masks, separate_depth_stencil_layouts true/false, sampled_in_general, write-suppression variant requests, and ClearDepthStencil read-only skipping.

Negative control & verification

  • On unmodified main (ec91d695c), d3d12_dsv_readonly_test failed all 6 GPU checks on RTX 5070 (unknown flag 0x4 accepted, READ_ONLY_DEPTH overwrote depth to 0x400000 causing the second draw to fail depth test, READ_ONLY_STENCIL and READ_ONLY_BOTH modified depth/stencil, partial clear overwrote read-only depth, and D32_FLOAT READ_ONLY_DEPTH overwrote 0.75 with 0.25).
  • With the fix:
    • ctest -R "^(dsv_readonly_replay|d3d12_dsv_readonly|d3d12_state_map|vk_command_replay|d3d12_depth24_draw|d3d12_typeless_depth)$": 6/6 passed.
    • python scripts/check_no_game_data.py: clean.
    • python -m unittest tests/test_ctest_registration.py: 6/6 OK.
    • git diff --check: clean.

GPUs tested: NVIDIA GeForce RTX 5070 (Windows 11, native Vulkan; VK_LAYER_KHRONOS_validation not installed locally).

AI-assisted.
Independent Vulkan validation on RTX 3080: four synthetic DSV tests passed, including the precise-occlusion assertion. That run covers the D32 control. Test report.

Follow-up after merging main

At c6fabd3395 with main bd643e46e7, both sides' CMake test registrations are present. On Windows 10 22H2, RTX 5070 (610.88), MSVC 19.44 and Khronos validation, all four selected tests passed: dsv_readonly_replay, d3d12_dsv_readonly, depth24_cpu, and d3d12_depth24_draw. The same-draw packed depth/stencil case described above remains open.

Independent native Linux GPU follow-up at c6fabd339 on RADV and NVIDIA confirmed that the post-render transition restores shader reads in GENERAL. All eight mixed draws and eight sample-only controls returned the expected pixels with synchronization validation enabled. Removing only the restoration triggered a descriptor/image layout validation error in all eight recordings. Test report

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5529951063 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-27T16:31:10Z. --- Part of `RT-STATE-AUDIT-FORMATS` (#2464; based on the format-state audit notes in #1608 by `@kevincommits` and `@Tauwni`). ### Summary - Store validated DSV read-only flags (`dsv_read_only_depth`, `dsv_read_only_stencil`) on `TargetView` (`runtime/src/command_list.h`; `sizeof(TargetView) == 32 <= kDescriptorSize`). - Validate `desc->Flags` in `CreateDepthStencilView` (`runtime/shims/d3d12_vulkan_device.cpp`), rejecting unknown flag bits and recording `D3D12_DSV_FLAG_READ_ONLY_DEPTH` / `D3D12_DSV_FLAG_READ_ONLY_STENCIL`. - Replay read-only depth/stencil attachments properly in `runtime/src/vulkan_replay.h`: - Separate `VkRenderingAttachmentInfo` for depth and stencil with `VK_ATTACHMENT_STORE_OP_NONE`, read-only access masks (`VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT`), and per-aspect read-only layouts when `separate_depth_stencil_layouts` is enabled (or `DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL` / `DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL` when coupled). - Use `VK_IMAGE_LAYOUT_GENERAL` for read-only depth/stencil with bindless sampling where the Vulkan attachment access rules allow it. Simultaneous sampling of one aspect of a packed depth/stencil image while storing the sibling on devices without `separateDepthStencilAttachmentAccess` remains open. When the sampled aspect entered the draw in GENERAL, replay restores that layout for subsequent reads after the attachment scope ends. See the [review](https://github.com/ProjectLeonida/mandy/pull/2480#pullrequestreview-6098417939). - Skip redundant intra-layout memory barriers for read-only attachments and mask out read-only aspects in `ClearDepthStencil`. - Add `GraphicsPipeline::read_only_depth` / `read_only_stencil` variant bits (`runtime/src/vulkan_replay.h`, `runtime/shims/d3d12_vulkan_device.cpp`) so pipelines with `DepthWriteMask = ALL` or nonzero stencil write masks suppress writes cleanly when drawn against a read-only DSV (no variant is built when the PSO already disables writes). ### Tests - `runtime/test/d3d12_dsv_readonly_test.cpp` (`d3d12_dsv_readonly`, skips with 77 if no Vulkan GPU): exercises unknown-flag rejection, mixed `READ_ONLY_DEPTH` + writable stencil, mixed writable depth + `READ_ONLY_STENCIL`, `READ_ONLY_DEPTH | READ_ONLY_STENCIL`, read-only `ClearDepthStencilView` masking, and `D32_FLOAT` `READ_ONLY_DEPTH` on GPU. - `runtime/test/dsv_readonly_replay_test.cpp` (`dsv_readonly_replay`, CPU-only, no GPU required): verifies attachment layouts, `storeOp`, barrier access masks, `separate_depth_stencil_layouts` true/false, `sampled_in_general`, write-suppression variant requests, and `ClearDepthStencil` read-only skipping. ### Negative control & verification - On unmodified `main` (`ec91d695c`), `d3d12_dsv_readonly_test` failed all 6 GPU checks on RTX 5070 (unknown flag `0x4` accepted, `READ_ONLY_DEPTH` overwrote depth to `0x400000` causing the second draw to fail depth test, `READ_ONLY_STENCIL` and `READ_ONLY_BOTH` modified depth/stencil, partial clear overwrote read-only depth, and `D32_FLOAT` `READ_ONLY_DEPTH` overwrote `0.75` with `0.25`). - With the fix: - `ctest -R "^(dsv_readonly_replay|d3d12_dsv_readonly|d3d12_state_map|vk_command_replay|d3d12_depth24_draw|d3d12_typeless_depth)$"`: 6/6 passed. - `python scripts/check_no_game_data.py`: clean. - `python -m unittest tests/test_ctest_registration.py`: 6/6 OK. - `git diff --check`: clean. GPUs tested: NVIDIA GeForce RTX 5070 (Windows 11, native Vulkan; `VK_LAYER_KHRONOS_validation` not installed locally). AI-assisted. Independent Vulkan validation on RTX 3080: four synthetic DSV tests passed, including the precise-occlusion assertion. That run covers the D32 control. [Test report](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7245485735). ### Follow-up after merging main At `c6fabd3395` with `main` `bd643e46e7`, both sides' CMake test registrations are present. On Windows 10 22H2, RTX 5070 (610.88), MSVC 19.44 and Khronos validation, all four selected tests passed: `dsv_readonly_replay`, `d3d12_dsv_readonly`, `depth24_cpu`, and `d3d12_depth24_draw`. The same-draw packed depth/stencil case described above remains open. Independent native Linux GPU follow-up at `c6fabd339` on RADV and NVIDIA confirmed that the post-render transition restores shader reads in `GENERAL`. All eight mixed draws and eight sample-only controls returned the expected pixels with synchronization validation enabled. Removing only the restoration triggered a descriptor/image layout validation error in all eight recordings. [Test report](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7257827239)
djrolfes commented 2026-11-27 17:15:00 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by djrolfes on 2026-11-27T17:15:00Z.


Independent Linux/Wine + NVIDIA check at head 86b890ca1 (merged cleanly onto origin/main c0201a806 alongside #2478, #2477, #2476, #2474).

  • 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:
    • d3d12_dsv_readonly: passed (6.06 s) on RTX 3070 Ti under Wine.
    • dsv_readonly_replay: passed (4.42 s) under Wine.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7224195640 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2480#issuecomment-7224195640). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-27T17:15:00Z. --- Independent Linux/Wine + NVIDIA check at head `86b890ca1` (merged cleanly onto `origin/main` `c0201a806` alongside `#2478`, `#2477`, `#2476`, `#2474`). - **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:** - `d3d12_dsv_readonly`: **passed** (`6.06 s`) on RTX 3070 Ti under Wine. - `dsv_readonly_replay`: **passed** (`4.42 s`) under Wine. AI-assisted.
MoonEyes commented 2026-11-27 19:53:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T19:53:29Z.


Tested for #2464 as Aslanek asked: unit tests and a game run on my machine; CI ignored for now as asked.

RUN pr2480-court | 2026-11-27 | MoonEyes | AI-assisted: Claude Code (Claude Opus 5.5)
BASE:        main ec91d695c + PR #2480 (head 86b890ca1), merged locally without conflict, nothing pushed | shaders: main's own translation
MACHINE:     RTX 4060 8 GB, desktop, only GPU, display attached | NVIDIA 610.88 | Windows 11 Pro 26300 | Ryzen 5 3600 | 32 GB | Windows GPU timeout at the default (2 s)
RECIPE:      short recipe: docs/running.md Windows NVIDIA recipe, pipeline cache warm, 330 s cap, scripted button presses from 60 s | build RelWithDebInfo, only the PR's targets built
TESTS:
  - d3d12_dsv_readonly_test (new): pass on the PR | the PR's test built on main's sources: fails (exit 1)
  - dsv_readonly_replay_test (new): pass on the PR (8 checks) | cannot build on main: it uses the new depth/stencil write members of the pipeline struct, which main does not have (checked in the source, not compiled)
GAME:        session=1 at 200 s | world entered at 260 s | last window >= 1 img/s ends at 329 s | end: time limit (cap 330 s, ended at 350 s) | device loss: no (no fault report) | private RAM max 12175 MB
COMPARED TO: w77 (main ec91d695c, same short recipe): session=1 at 145 s, world at 195 s, last window >= 1 img/s at 293 s, private RAM max 16043 MB, ended by the time limit (337 s)
             one run each (n=1); main alone on this exact recipe entered the world at 195 and 200 s (two runs), main with one setting changed at 165-175 s, so no conclusion on timings
VERDICT:     both new tests pass and cannot pass on main; game run clean to the time limit, no device loss; no timing conclusion (n=1)

Reading (marked):

  • MEASURED: this run entered the world later (260 s) than every main run I have on this recipe (195 and 200 s; 165-175 s with one setting changed) and used less private RAM (12.2 vs 16.0 GB). With one run I do not attribute either to the PR; a second run would be needed to say more.
  • MEASURED: the run reached the time limit without a device loss; this says the PR does not break the game boot on this machine, not that it changes anything in the game.

Limits: one machine, one run for the PR, one run for the main witness.

AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7226970018 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7226970018). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T19:53:29Z. --- Tested for #2464 as Aslanek asked: unit tests and a game run on my machine; CI ignored for now as asked. ``` RUN pr2480-court | 2026-11-27 | MoonEyes | AI-assisted: Claude Code (Claude Opus 5.5) BASE: main ec91d695c + PR #2480 (head 86b890ca1), merged locally without conflict, nothing pushed | shaders: main's own translation MACHINE: RTX 4060 8 GB, desktop, only GPU, display attached | NVIDIA 610.88 | Windows 11 Pro 26300 | Ryzen 5 3600 | 32 GB | Windows GPU timeout at the default (2 s) RECIPE: short recipe: docs/running.md Windows NVIDIA recipe, pipeline cache warm, 330 s cap, scripted button presses from 60 s | build RelWithDebInfo, only the PR's targets built TESTS: - d3d12_dsv_readonly_test (new): pass on the PR | the PR's test built on main's sources: fails (exit 1) - dsv_readonly_replay_test (new): pass on the PR (8 checks) | cannot build on main: it uses the new depth/stencil write members of the pipeline struct, which main does not have (checked in the source, not compiled) GAME: session=1 at 200 s | world entered at 260 s | last window >= 1 img/s ends at 329 s | end: time limit (cap 330 s, ended at 350 s) | device loss: no (no fault report) | private RAM max 12175 MB COMPARED TO: w77 (main ec91d695c, same short recipe): session=1 at 145 s, world at 195 s, last window >= 1 img/s at 293 s, private RAM max 16043 MB, ended by the time limit (337 s) one run each (n=1); main alone on this exact recipe entered the world at 195 and 200 s (two runs), main with one setting changed at 165-175 s, so no conclusion on timings VERDICT: both new tests pass and cannot pass on main; game run clean to the time limit, no device loss; no timing conclusion (n=1) ``` Reading (marked): - MEASURED: this run entered the world later (260 s) than every main run I have on this recipe (195 and 200 s; 165-175 s with one setting changed) and used less private RAM (12.2 vs 16.0 GB). With one run I do not attribute either to the PR; a second run would be needed to say more. - MEASURED: the run reached the time limit without a device loss; this says the PR does not break the game boot on this machine, not that it changes anything in the game. Limits: one machine, one run for the PR, one run for the main witness. AI-assisted (Claude Code, Claude Opus 5.5)
timbot103 commented 2026-11-28 01:33:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T01:33:45Z.


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

Verification

  • Built dsv_readonly_replay_test, d3d12_dsv_readonly_test, d3d12_depth24_draw_test, and gta6rt.
  • dsv_readonly_replay_test: passed (8/8 checks).
  • d3d12_dsv_readonly_test (LEONIDA_VK_VALIDATION=1): passed with 0 validation errors on both NVIDIA GeForce RTX 5080 (616.64) and AMD Radeon(TM) Graphics (25.10.30.02).
  • d3d12_depth24_draw_test (LEONIDA_VK_VALIDATION=1): passed on both RTX 5080 and AMD Radeon (0 validation errors).

Findings (Request changes)

  1. Shader-read synchronization gap when transitioning a read-only DSV to VK_IMAGE_LAYOUT_GENERAL (vulkan_replay.h:5592-5601, 3046-3059):
    On the normal bindless path (sampled_in_general), image_layout() maps DEPTH_STENCIL_READ_ONLY_OPTIMAL and the mixed read-only layouts to VK_IMAGE_LAYOUT_GENERAL. detail::to_attachment() emits the layout transition with dstAccessMask limited to VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT (or depth_access) and dstStageMask limited to EARLY_FRAGMENT_TESTS | LATE_FRAGMENT_TESTS. If a resource is already in D3D12_RESOURCE_STATE_DEPTH_READ | NON_PIXEL_SHADER_RESOURCE (or PIXEL_SHADER_RESOURCE) and transitions from attachment layout to GENERAL at draw time without an intervening D3D12 barrier, a shader sampling the read-only depth/stencil in that draw (e.g., vertex/mesh/fragment) is outside the barrier's destination scope. The coupled-plane fallback (separate == false, vulkan_replay.h:1738-1742) has the same destination scope gap. Please include VK_ACCESS_SHADER_READ_BIT and the consuming shader stages when transitioning into a shader-readable/general layout.
  2. Packed depth/stencil sibling STORE vs. GENERAL sampling (vulkan_replay.h:434-439, 5603-5610; d3d12_vulkan_device.cpp:22013-22016):
    A mixed read-only D24S8 draw sets STORE_OP_NONE on the read-only aspect and STORE_OP_STORE on the writable sibling while placing the read-only aspect in GENERAL. Per the Vulkan render pass store-operation rules, on implementations where VkPhysicalDeviceMaintenance7PropertiesKHR::separateDepthStencilAttachmentAccess == VK_FALSE, storing the writable sibling aspect can still read/write back the read-only aspect, racing a shader sampling it. Device selection currently checks separateDepthStencilLayouts only, and d3d12_dsv_readonly_test uses an empty pixel shader without SRV sampling so it does not exercise this case. Please gate or guard simultaneous sampling of a packed depth/stencil aspect when separateDepthStencilAttachmentAccess is unavailable.
  3. Async pipeline pre-warm drops the read-only variant key (d3d12_com.cpp:2042-2047; d3d12_vulkan_device.cpp:12922-12939):
    Under LEONIDA_ASYNC_PIPELINES=1, request_draw_pipeline() / request_early() only passes depth_.resource != 0 and omits depth_.dsv_flags. Recording pre-compiles the writable variant, while replay requests the read-only variant key (vulkan_replay.h:2872-2889), which can cause the first read-only draw to be skipped while that variant compiles. Passing depth_.dsv_flags into request_pipeline_build / request_early keeps recording and replay in sync.
  4. Fully suppressed rectangular clear still invokes rect_view (vulkan_replay.h:3675-3678):
    When read-only flags mask out all requested clear aspects, line 3675 sets p.skip = true, but line 3676 still unconditionally calls rect_view(...). With non-empty rects, that still requires rendering hooks and allocates an image view (and can return unsupported if !rendering) for a no-op clear. Guarding rect_view with if (!p.skip) after view_range() avoids this.
  5. Minor test note (d3d12_dsv_readonly_test.cpp:181-187, 451):
    The test writes shaders to a fixed temp directory name and removes it on exit, which can collide if two instances run concurrently (including PID or a unique suffix avoids that).

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7231754368 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7231754368). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T01:33:45Z. --- Reviewed at head `86b890ca1` on Windows 11 (MSVC 2022 `19.44`) with dual-GPU Vulkan validation (`LEONIDA_VK_VALIDATION=1`, Vulkan SDK `1.4.363.0`). ### Verification - Built `dsv_readonly_replay_test`, `d3d12_dsv_readonly_test`, `d3d12_depth24_draw_test`, and `gta6rt`. - `dsv_readonly_replay_test`: **passed** (8/8 checks). - `d3d12_dsv_readonly_test` (`LEONIDA_VK_VALIDATION=1`): **passed** with 0 validation errors on both **NVIDIA GeForce RTX 5080** (`616.64`) and **AMD Radeon(TM) Graphics** (`25.10.30.02`). - `d3d12_depth24_draw_test` (`LEONIDA_VK_VALIDATION=1`): **passed** on both RTX 5080 and AMD Radeon (0 validation errors). ### Findings (Request changes) 1. **Shader-read synchronization gap when transitioning a read-only DSV to `VK_IMAGE_LAYOUT_GENERAL` (`vulkan_replay.h:5592-5601`, `3046-3059`):** On the normal bindless path (`sampled_in_general`), `image_layout()` maps `DEPTH_STENCIL_READ_ONLY_OPTIMAL` and the mixed read-only layouts to `VK_IMAGE_LAYOUT_GENERAL`. `detail::to_attachment()` emits the layout transition with `dstAccessMask` limited to `VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT` (or `depth_access`) and `dstStageMask` limited to `EARLY_FRAGMENT_TESTS | LATE_FRAGMENT_TESTS`. If a resource is already in `D3D12_RESOURCE_STATE_DEPTH_READ | NON_PIXEL_SHADER_RESOURCE` (or `PIXEL_SHADER_RESOURCE`) and transitions from attachment layout to `GENERAL` at draw time without an intervening D3D12 barrier, a shader sampling the read-only depth/stencil in that draw (e.g., vertex/mesh/fragment) is outside the barrier's destination scope. The coupled-plane fallback (`separate == false`, `vulkan_replay.h:1738-1742`) has the same destination scope gap. Please include `VK_ACCESS_SHADER_READ_BIT` and the consuming shader stages when transitioning into a shader-readable/general layout. 2. **Packed depth/stencil sibling `STORE` vs. `GENERAL` sampling (`vulkan_replay.h:434-439`, `5603-5610`; `d3d12_vulkan_device.cpp:22013-22016`):** A mixed read-only D24S8 draw sets `STORE_OP_NONE` on the read-only aspect and `STORE_OP_STORE` on the writable sibling while placing the read-only aspect in `GENERAL`. Per the Vulkan render pass store-operation rules, on implementations where `VkPhysicalDeviceMaintenance7PropertiesKHR::separateDepthStencilAttachmentAccess == VK_FALSE`, storing the writable sibling aspect can still read/write back the read-only aspect, racing a shader sampling it. Device selection currently checks `separateDepthStencilLayouts` only, and `d3d12_dsv_readonly_test` uses an empty pixel shader without SRV sampling so it does not exercise this case. Please gate or guard simultaneous sampling of a packed depth/stencil aspect when `separateDepthStencilAttachmentAccess` is unavailable. 3. **Async pipeline pre-warm drops the read-only variant key (`d3d12_com.cpp:2042-2047`; `d3d12_vulkan_device.cpp:12922-12939`):** Under `LEONIDA_ASYNC_PIPELINES=1`, `request_draw_pipeline()` / `request_early()` only passes `depth_.resource != 0` and omits `depth_.dsv_flags`. Recording pre-compiles the writable variant, while replay requests the read-only variant key (`vulkan_replay.h:2872-2889`), which can cause the first read-only draw to be skipped while that variant compiles. Passing `depth_.dsv_flags` into `request_pipeline_build` / `request_early` keeps recording and replay in sync. 4. **Fully suppressed rectangular clear still invokes `rect_view` (`vulkan_replay.h:3675-3678`):** When read-only flags mask out all requested clear aspects, line 3675 sets `p.skip = true`, but line 3676 still unconditionally calls `rect_view(...)`. With non-empty `rects`, that still requires `rendering` hooks and allocates an image view (and can return `unsupported` if `!rendering`) for a no-op clear. Guarding `rect_view` with `if (!p.skip)` after `view_range()` avoids this. 5. **Minor test note (`d3d12_dsv_readonly_test.cpp:181-187`, `451`):** The test writes shaders to a fixed temp directory name and removes it on exit, which can collide if two instances run concurrently (including PID or a unique suffix avoids that). AI-assisted review + local MSVC/dual-GPU verification.
akimfomin commented 2026-11-28 02:00:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by akimfomin on 2026-11-28T02:00:21Z.


KLBF #27 supplies a separate depth-bounds control. For the read-only DSV fix, run otherwise identical draws with write enabled, read-only depth and no stencil attachment. Match query and color results while asserting the depth value can change only in the writable arm. That independently checks bound state and masking.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232062835 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7232062835). Originally posted by [akimfomin](https://github.com/akimfomin) on 2026-11-28T02:00:21Z. --- [KLBF #27](https://github.com/PastiiJay/klbf-lab/pull/27) supplies a separate depth-bounds control. For the read-only DSV fix, run otherwise identical draws with write enabled, read-only depth and no stencil attachment. Match query and color results while asserting the depth value can change only in the writable arm. That independently checks bound state and masking.
lixonik commented 2026-11-28 09:50:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T09:50:41Z.


@timbot103 @akimfomin Addressed all review findings and added the paired writable-vs-readonly D32 control in 2f5e8a808:

  1. Shader-read sync scope on read-only DSV draw transitions ( ulkan_replay.h): Included VK_ACCESS_SHADER_READ_BIT and VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT on both the split && separate and coupled (!split || !separate) paths whenever transitioning a read-only depth/stencil aspect.
  2. Packed depth/stencil sibling STORE vs GENERAL sampling ( ulkan_replay.h, ulkan_backend.h, d3d12_com.h, d3d12_vulkan_device.cpp): Query VkPhysicalDeviceMaintenance7PropertiesKHR::separateDepthStencilAttachmentAccess (both during create_vulkan_device and for caller-provided VulkanDeviceInfo). Use VK_ATTACHMENT_STORE_OP_NONE whenever an aspect is read-only or not written by the pipeline, and when !separateDepthStencilAttachmentAccess on a mixed read-only draw with a storing sibling, keep the read-only aspect in its optimal read-only layout instead of promoting it to GENERAL via sampled_in_general (with a one-time diagnostic).
  3. Async pipeline pre-warm variant key (d3d12_com.h, d3d12_com.cpp, d3d12_vulkan_device.cpp): Threaded depth_.dsv_flags through
    equest_pipeline_build -> PipelineState::request_early so recording pre-warms the same
    ead_only_depth /
    ead_only_stencil variant bits as replay.
  4. Fully suppressed rectangular clear ( ulkan_replay.h): Guarded
    ect_view(...) with if (!p.skip) after iew_range() so no-op rectangular clears do not require rendering hooks or allocate an image view.
  5. Test isolation & paired D32 control (d3d12_dsv_readonly_test.cpp, dsv_readonly_replay_test.cpp): Scoped the shader temp directory by PID, added a paired read-only vs writable D32_FLOAT (no stencil attachment) draw with matching occlusion query counts asserting depth updates only in the writable arm, and added replay regression checks for shader-read barrier scope, separateDepthStencilAttachmentAccess gating ( rue/ alse/non-writing sibling), and suppressed rectangular clears.

Verification

  • Built dsv_readonly_replay_test, d3d12_dsv_readonly_test, d3d12_depth24_draw_test, and gta6rt (Windows 11, MSVC 19.44, Ninja Release).
  • dsv_readonly_replay_test: 12/12 checks passed.
  • d3d12_dsv_readonly_test (LEONIDA_VK_VALIDATION=1): passed, 0 validation errors.
  • d3d12_depth24_draw_test (LEONIDA_VK_VALIDATION=1): passed, 0 validation errors.
  • scripts/check_no_game_data.py and git diff --check: clean.

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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237503529 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7237503529). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T09:50:41Z. --- @timbot103 @akimfomin Addressed all review findings and added the paired writable-vs-readonly D32 control in `2f5e8a808`: 1. **Shader-read sync scope on read-only DSV draw transitions ( ulkan_replay.h):** Included VK_ACCESS_SHADER_READ_BIT and VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT on both the split && separate and coupled (!split || !separate) paths whenever transitioning a read-only depth/stencil aspect. 2. **Packed depth/stencil sibling STORE vs GENERAL sampling ( ulkan_replay.h, ulkan_backend.h, d3d12_com.h, d3d12_vulkan_device.cpp):** Query VkPhysicalDeviceMaintenance7PropertiesKHR::separateDepthStencilAttachmentAccess (both during create_vulkan_device and for caller-provided VulkanDeviceInfo). Use VK_ATTACHMENT_STORE_OP_NONE whenever an aspect is read-only or not written by the pipeline, and when !separateDepthStencilAttachmentAccess on a mixed read-only draw with a storing sibling, keep the read-only aspect in its optimal read-only layout instead of promoting it to GENERAL via sampled_in_general (with a one-time diagnostic). 3. **Async pipeline pre-warm variant key (d3d12_com.h, d3d12_com.cpp, d3d12_vulkan_device.cpp):** Threaded depth_.dsv_flags through equest_pipeline_build -> PipelineState::request_early so recording pre-warms the same ead_only_depth / ead_only_stencil variant bits as replay. 4. **Fully suppressed rectangular clear ( ulkan_replay.h):** Guarded ect_view(...) with if (!p.skip) after iew_range() so no-op rectangular clears do not require rendering hooks or allocate an image view. 5. **Test isolation & paired D32 control (d3d12_dsv_readonly_test.cpp, dsv_readonly_replay_test.cpp):** Scoped the shader temp directory by PID, added a paired read-only vs writable D32_FLOAT (no stencil attachment) draw with matching occlusion query counts asserting depth updates only in the writable arm, and added replay regression checks for shader-read barrier scope, separateDepthStencilAttachmentAccess gating ( rue/ alse/non-writing sibling), and suppressed rectangular clears. ### Verification - Built dsv_readonly_replay_test, d3d12_dsv_readonly_test, d3d12_depth24_draw_test, and gta6rt (Windows 11, MSVC 19.44, Ninja Release). - dsv_readonly_replay_test: **12/12 checks passed**. - d3d12_dsv_readonly_test (LEONIDA_VK_VALIDATION=1): **passed**, 0 validation errors. - d3d12_depth24_draw_test (LEONIDA_VK_VALIDATION=1): **passed**, 0 validation errors. - scripts/check_no_game_data.py and git diff --check: clean. 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).
timbot103 commented 2026-11-28 14:36:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T14:36:21Z.

Review: COMMENTED


Static code audit against 92e574a1a + ec740bcc3. I found two issues.

  • Major (runtime/src/vulkan_replay.h:5604). When packed depth/stencil attachment access is coupled and the writable sibling stores, the fallback takes the read-only aspect out of GENERAL. The bindless SRV still declares GENERAL (runtime/shims/d3d12_vulkan_device.cpp:8052). A draw that samples that aspect violates VUID-vkCmdDraw-imageLayout-00344, and the tracked layout also persists for later reads in the same D3D12 state. Please use an isolated sampled copy with a matching descriptor or explicitly refuse the unsupported simultaneous use. Preserve the SRV layout for subsequent reads. The current GPU test declares an SRV state but never samples the image. Vulkan draw validity
  • Minor (runtime/test/d3d12_dsv_readonly_test.cpp:504). Require equal expected sample counts when occlusion queries are precise. With imprecise queries, each passing draw only guarantees a nonzero result. Vulkan occlusion queries

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6098417939 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#pullrequestreview-6098417939). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T14:36:21Z. **Review:** COMMENTED --- Static code audit against `92e574a1a` + `ec740bcc3`. I found two issues. - **Major** (`runtime/src/vulkan_replay.h:5604`). When packed depth/stencil attachment access is coupled and the writable sibling stores, the fallback takes the read-only aspect out of `GENERAL`. The bindless SRV still declares `GENERAL` (`runtime/shims/d3d12_vulkan_device.cpp:8052`). A draw that samples that aspect violates `VUID-vkCmdDraw-imageLayout-00344`, and the tracked layout also persists for later reads in the same D3D12 state. Please use an isolated sampled copy with a matching descriptor or explicitly refuse the unsupported simultaneous use. Preserve the SRV layout for subsequent reads. The current GPU test declares an SRV state but never samples the image. [Vulkan draw validity](https://docs.vulkan.org/refpages/latest/refpages/source/vkCmdDraw.html) - **Minor** (`runtime/test/d3d12_dsv_readonly_test.cpp:504`). Require equal expected sample counts when occlusion queries are precise. With imprecise queries, each passing draw only guarantees a nonzero result. [Vulkan occlusion queries](https://docs.vulkan.org/spec/latest/chapters/queries.html#queries-occlusion) AI-assisted.
lixonik commented 2026-11-28 15:45:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T15:45:30Z.


@timbot103 bd9479348 fixes the query assertion. Both arms must equal the expected sample count with precise queries. Without them both must be nonzero. d3d12_dsv_readonly and dsv_readonly_replay passed on RTX 5070.

The packed depth/stencil sampled-layout issue is still open. A resource marked sampled_in_general may have an SRV even when the draw does not sample it, so rejecting every mixed DSV with that flag would reject ordinary stencil draws as well. The remaining fix needs to preserve the sampled layout and identify or isolate the simultaneous read before recording the draw.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241711751 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7241711751). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T15:45:30Z. --- @timbot103 `bd9479348` fixes the query assertion. Both arms must equal the expected sample count with precise queries. Without them both must be nonzero. `d3d12_dsv_readonly` and `dsv_readonly_replay` passed on RTX 5070. The packed depth/stencil sampled-layout issue is still open. A resource marked `sampled_in_general` may have an SRV even when the draw does not sample it, so rejecting every mixed DSV with that flag would reject ordinary stencil draws as well. The remaining fix needs to preserve the sampled layout and identify or isolate the simultaneous read before recording the draw. AI-assisted.
Maticcm commented 2026-11-28 20:42:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Maticcm on 2026-11-28T20:42:48Z.


Verified bd9479348822513ff5ffab1a0c0503adb92d35b0 independently on native Windows, using an RTX 3080 desktop (10 GiB, driver 630.20), Windows 11 build 26340, MSVC 19.50.35717, RelWithDebInfo and Vulkan SDK 1.4.363.1 with Khronos validation enabled.

  • d3d12_dsv_readonly passed with zero validation errors. This covered the D32_FLOAT writable/read-only pair and the occlusion count assertion. vulkaninfo reported occlusionQueryPrecise = true for the RTX 3080, and the fixture enables that feature when advertised.
  • dsv_readonly_replay, d3d12_depth24_draw, and d3d12_typeless_depth also passed. The two shared depth controls passed at common ancestor 5f3790c8e875288da8cf05081d661471088e1e0a. Overall 4/4 at the PR head and 2/2 at the ancestor, with no CTest skips.

Synthetic fixtures. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245485735 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7245485735). Originally posted by [Maticcm](https://github.com/Maticcm) on 2026-11-28T20:42:48Z. --- Verified `bd9479348822513ff5ffab1a0c0503adb92d35b0` independently on native Windows, using an RTX 3080 desktop (10 GiB, driver 630.20), Windows 11 build 26340, MSVC 19.50.35717, RelWithDebInfo and Vulkan SDK 1.4.363.1 with Khronos validation enabled. - `d3d12_dsv_readonly` passed with zero validation errors. This covered the D32_FLOAT writable/read-only pair and the occlusion count assertion. `vulkaninfo` reported `occlusionQueryPrecise = true` for the RTX 3080, and the fixture enables that feature when advertised. - `dsv_readonly_replay`, `d3d12_depth24_draw`, and `d3d12_typeless_depth` also passed. The two shared depth controls passed at common ancestor `5f3790c8e875288da8cf05081d661471088e1e0a`. Overall 4/4 at the PR head and 2/2 at the ancestor, with no CTest skips. Synthetic fixtures. AI-assisted (Codex).
lixonik commented 2026-11-28 21:13:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-28T21:13:52Z.


@timbot103 9f534d3ca fixes the later-read half of the packed depth/stencil layout issue. If the sampled aspect entered a mixed draw in GENERAL and the attachment uses the optimal fallback, replay restores its GENERAL layout after ending rendering. On coupled-layout devices this restores both planes together. The mock regression fails on the previous head and now passes in both split and coupled modes.

All four focused CTests passed on RTX 5070 (610.88), Windows 10 22H2, MSVC 19.44, with Khronos validation available. The simultaneous sampled draw on hardware without separateDepthStencilAttachmentAccess remains open; this change covers reads after that attachment scope.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245866801 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7245866801). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T21:13:52Z. --- @timbot103 `9f534d3ca` fixes the later-read half of the packed depth/stencil layout issue. If the sampled aspect entered a mixed draw in GENERAL and the attachment uses the optimal fallback, replay restores its GENERAL layout after ending rendering. On coupled-layout devices this restores both planes together. The mock regression fails on the previous head and now passes in both split and coupled modes. All four focused CTests passed on RTX 5070 (610.88), Windows 10 22H2, MSVC 19.44, with Khronos validation available. The simultaneous sampled draw on hardware without separateDepthStencilAttachmentAccess remains open; this change covers reads after that attachment scope. AI-assisted.
zmasi commented 2026-11-28 21:46:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T21:46:06Z.


Verified updated head 9f534d3ca merged with main aa918e5d9 on physical gfx906 (RADV Mesa 26.0.8, Linux Wine 11.0). With D32 cleared to 0.75 and a draw at 0.25, main stored 0.25 through both the read-only and writable views. The merge kept 0.75 read-only / 0.25 writable. Precise occlusion counted 1,024 samples in both arms on both builds: the read-only draw ran rather than disappearing.

The packed depth/stencil cases used the D32S8 fallback on this device. With depth read-only, the merge preserved 0.75 while stencil incremented twice to 18; main overwrote depth with 0.25 and stencil reached only 17. A partial clear on the merge left depth unchanged and updated stencil. Main reported one synchronization write-after-write hazard; the merged fixture passed without validation errors, hazards or device loss.

The new post-render GENERAL restoration was checked separately at the replay boundary: 4/16 on the preceding PR head versus 16/16 on this revision across split/coupled aspect layouts, mixed entry layouts and untouched mip/layer neighbors. Only ranges that entered in GENERAL were restored. This was a host-side command/tracker check, not a physical later-sample result. Simultaneous sampling while a writable sibling stores was not tested.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246256877 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7246256877). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T21:46:06Z. --- Verified updated head `9f534d3ca` merged with main `aa918e5d9` on physical gfx906 (RADV Mesa 26.0.8, Linux Wine 11.0). With D32 cleared to 0.75 and a draw at 0.25, main stored 0.25 through both the read-only and writable views. The merge kept **0.75 read-only / 0.25 writable**. Precise occlusion counted 1,024 samples in both arms on both builds: the read-only draw ran rather than disappearing. The packed depth/stencil cases used the D32S8 fallback on this device. With depth read-only, the merge preserved 0.75 while stencil incremented twice to 18; main overwrote depth with 0.25 and stencil reached only 17. A partial clear on the merge left depth unchanged and updated stencil. Main reported one synchronization write-after-write hazard; the merged fixture passed without validation errors, hazards or device loss. The new post-render `GENERAL` restoration was checked separately at the replay boundary: **4/16** on the preceding PR head versus **16/16** on this revision across split/coupled aspect layouts, mixed entry layouts and untouched mip/layer neighbors. Only ranges that entered in `GENERAL` were restored. This was a host-side command/tracker check, not a physical later-sample result. Simultaneous sampling while a writable sibling stores was not tested. AI-assisted.
TheGeogeo commented 2026-11-29 11:54:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T11:54:14Z.


Checked 9f534d3ca against main 8fb974878 on Windows 11 10.0.26300: it does not merge (git merge-tree --write-tree), so I ran no tests.

  • Conflict: runtime/CMakeLists.txt, add/add. 06c3b4a6a (2026-11-25, RT-D24-CPU-ROUNDEVEN) added the depth24_cpu_test block where this PR adds its test targets.
  • Still needed (STALE, needs a rebase): main has no handling of D3D12_DSV_FLAG_READ_ONLY_DEPTH / READ_ONLY_STENCIL in runtime/shims or runtime/src. The rebase looks mechanical: keep both CMake blocks.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7255428095 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7255428095). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T11:54:14Z. --- Checked `9f534d3ca` against `main` `8fb974878` on Windows 11 10.0.26300: it does not merge (`git merge-tree --write-tree`), so I ran no tests. - Conflict: `runtime/CMakeLists.txt`, add/add. `06c3b4a6a` (2026-11-25, RT-D24-CPU-ROUNDEVEN) added the `depth24_cpu_test` block where this PR adds its test targets. - Still needed (STALE, needs a rebase): `main` has no handling of `D3D12_DSV_FLAG_READ_ONLY_DEPTH` / `READ_ONLY_STENCIL` in `runtime/shims` or `runtime/src`. The rebase looks mechanical: keep both CMake blocks. AI-assisted (Claude Code).
merzleckeier commented 2026-11-29 15:06:36 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-29T15:06:36Z.


Physical follow-up for the post-render GENERAL restoration at PR head c6fabd339, merged cleanly onto c22a0a732 (tree 598d31332). I drove the production replay emitter on native Vulkan with a synthetic 8×8 D32_SFLOAT_S8_UINT image and forced the replay fallback for separate_depth_stencil_attachment_access. Both devices advertise the capability. I ran the split and coupled layout paths independently.

The test clears depth to 0.75 and stencil to 0x20. It then draws at 0.25 with the mixed read-only attachment. A subsequent compute dispatch in the same command buffer fetches the previously read-only aspect through a GENERAL descriptor, with no image barrier inserted by the test between replay and dispatch. The writable sibling is read back separately.

Draw Shader fetch after rendering, all 64 texels Writable sibling, all 64 texels
READ_ONLY_DEPTH 0.75 Stencil incremented to 0x21
READ_ONLY_STENCIL 0x20 Depth written to 0.25

8/8 draws and 8/8 sample-only controls passed, including attachment layout/store-op checks. The stock CPU fixture passed 12 checks. Khronos validation and synchronization validation reported zero errors. In a separate negative-control build I removed only the post-render restoration loop. All eight recordings then reported VUID-vkCmdDispatch-imageLayout-00344, and I discarded those command buffers before submission.

AMD Raphael iGPU (RADV Mesa 26.3.1-arch3.5) and RTX 4070 SUPER (NVIDIA 620.73.04), CachyOS, native Vulkan. This covers sampling after the attachment scope. Offline, synthetic inputs, AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257827239 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7257827239). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-29T15:06:36Z. --- Physical follow-up for the post-render `GENERAL` restoration at PR head `c6fabd339`, merged cleanly onto `c22a0a732` (tree `598d31332`). I drove the production replay emitter on native Vulkan with a synthetic 8×8 `D32_SFLOAT_S8_UINT` image and forced the replay fallback for `separate_depth_stencil_attachment_access`. Both devices advertise the capability. I ran the split and coupled layout paths independently. The test clears depth to 0.75 and stencil to 0x20. It then draws at 0.25 with the mixed read-only attachment. A subsequent compute dispatch in the same command buffer fetches the previously read-only aspect through a `GENERAL` descriptor, with no image barrier inserted by the test between replay and dispatch. The writable sibling is read back separately. | Draw | Shader fetch after rendering, all 64 texels | Writable sibling, all 64 texels | | --- | --- | --- | | READ_ONLY_DEPTH | 0.75 | Stencil incremented to 0x21 | | READ_ONLY_STENCIL | 0x20 | Depth written to 0.25 | 8/8 draws and 8/8 sample-only controls passed, including attachment layout/store-op checks. The stock CPU fixture passed 12 checks. Khronos validation and synchronization validation reported zero errors. In a separate negative-control build I removed only the post-render restoration loop. All eight recordings then reported `VUID-vkCmdDispatch-imageLayout-00344`, and I discarded those command buffers before submission. AMD Raphael iGPU (RADV Mesa 26.3.1-arch3.5) and RTX 4070 SUPER (NVIDIA 620.73.04), CachyOS, native Vulkan. This covers sampling after the attachment scope. Offline, synthetic inputs, AI-assisted.
lixonik commented 2026-11-29 15:54:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-29T15:54:57Z.


Merged main (bfb54b8759) as 1e2954d151 to resolve the runtime/src/vulkan_replay.h conflict with #778 (d3d-sample-positions):

  • Shifted GraphicsPipeline::read_only_depth / read_only_stencil to bits 11 / 12 so custom_samples keeps bit 10.
  • Forwarded active_samples through to_attachment, initialize, and the post-render sampled_depth_stencil_restore barrier.

Local verification (Windows 11, MSVC 19.44, RTX 5070, LEONIDA_VK_VALIDATION=1, VK_VALIDATE_SYNC=1):

  • ctest --output-on-failure -R "^(dsv_readonly_replay|d3d12_dsv_readonly|depth24_cpu|d3d12_depth24_draw)$": 4/4 passed.
  • python -I scripts/check_no_game_data.py: passed.
  • git merge-tree --write-tree main HEAD: clean against 1d3da5ebc7.

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258468942 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7258468942). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T15:54:57Z. --- Merged `main` (`bfb54b8759`) as `1e2954d151` to resolve the `runtime/src/vulkan_replay.h` conflict with #778 (`d3d-sample-positions`): - Shifted `GraphicsPipeline::read_only_depth` / `read_only_stencil` to bits `11` / `12` so `custom_samples` keeps bit `10`. - Forwarded `active_samples` through `to_attachment`, `initialize`, and the post-render `sampled_depth_stencil_restore` barrier. Local verification (Windows 11, MSVC 19.44, RTX 5070, `LEONIDA_VK_VALIDATION=1`, `VK_VALIDATE_SYNC=1`): - `ctest --output-on-failure -R "^(dsv_readonly_replay|d3d12_dsv_readonly|depth24_cpu|d3d12_depth24_draw)$"`: 4/4 passed. - `python -I scripts/check_no_game_data.py`: passed. - `git merge-tree --write-tree main HEAD`: clean against `1d3da5ebc7`. AI-assisted (Antigravity, Gemini).
merzleckeier commented 2026-11-30 12:31:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-11-30T12:31:21Z.


Independent Wine A/B on the current DSV revision. I built GitHub merge 717bd241 (a7f11116a over 497bdd039) in Win64 Release using clang-cl 23.1.5 and Windows SDK 10.0.26100. CachyOS, Wine 11.22, RTX 4070 SUPER (620.73.04) and Radeon 610M (RADV 26.3.1). Synthetic shaders and attachments.

  • MEASURED, PR. d3d12_dsv_readonly, d3d12_depth24_draw and dsv_readonly_replay passed on both GPUs. Replay reported 12 checks. The D32 read-only draw retained 0.75, the writable control stored 0.25, and its paired occlusion checks passed.
  • MEASURED, negative control. I built the identical checked-in DSV test against the runtime from main. Both GPUs reported the same six failures. They cover unknown flags, the three D24 depth/stencil read-only combinations, the partial clear, and D32 read-only depth changing to 0.25.
  • The host-forced Khronos layer reported the same vkCreateDevice diagnostic on both arms and both GPUs. VK_EXT_external_memory_dma_buf was enabled without VK_KHR_external_memory_fd (01387). The test logs show no additional validation error class.

AI-assisted with OpenAI Codex. The observations were independently checked against the raw logs.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7278554401 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7278554401). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-11-30T12:31:21Z. --- **Independent Wine A/B on the current DSV revision.** I built GitHub merge `717bd241` (`a7f11116a` over `497bdd039`) in Win64 Release using clang-cl 23.1.5 and Windows SDK 10.0.26100. CachyOS, Wine 11.22, RTX 4070 SUPER (620.73.04) and Radeon 610M (RADV 26.3.1). Synthetic shaders and attachments. - **MEASURED, PR.** `d3d12_dsv_readonly`, `d3d12_depth24_draw` and `dsv_readonly_replay` passed on both GPUs. Replay reported 12 checks. The D32 read-only draw retained 0.75, the writable control stored 0.25, and its paired occlusion checks passed. - **MEASURED, negative control.** I built the identical checked-in DSV test against the runtime from `main`. Both GPUs reported the same six failures. They cover unknown flags, the three D24 depth/stencil read-only combinations, the partial clear, and D32 read-only depth changing to 0.25. - The host-forced Khronos layer reported the same `vkCreateDevice` diagnostic on both arms and both GPUs. `VK_EXT_external_memory_dma_buf` was enabled without `VK_KHR_external_memory_fd` (`01387`). The test logs show no additional validation error class. AI-assisted with OpenAI Codex. The observations were independently checked against the raw logs.
ammonium231 commented 2026-11-30 13:43:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-30T13:43:42Z.


RTX 3090 / 621.40, validation on, a7f11116a merged onto main f9f3ec4c6: d3d12_dsv_readonly_test OK (all read-only flag cases), dsv_readonly_replay_test 12 pass, d3d12_depth24_draw_test 0 failures (main 0). No validation errors.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7280265951 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7280265951). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-11-30T13:43:42Z. --- RTX 3090 / 621.40, validation on, a7f11116a merged onto main f9f3ec4c6: d3d12_dsv_readonly_test OK (all read-only flag cases), dsv_readonly_replay_test 12 pass, d3d12_depth24_draw_test 0 failures (main 0). No validation errors.
lixonik commented 2026-11-30 19:49:16 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-30T19:49:16Z.


Fixed the replay_state_cache CI failure in a04eff9a4b:

  • Updated replay_state_cache_test.cpp's read-only DSV CPU mock to provide a pipeline variant callback and separate_depth_stencil_attachment_access = true (matching the GENERAL layout path it asserts).
  • Updated both live-GPU read-only depth tests in replay_state_cache_test.cpp to mark the read-only pipelines' depth_writes / stencil_writes accurately and pass the device's VK_KHR_maintenance7 separateDepthStencilAttachmentAccess property into VulkanContext (falling back to D32_SFLOAT when the device lacks separate attachment access).

Verified locally on Windows 11, MSVC 19.44, NVIDIA GeForce RTX 5070 12 GB (driver 610.88, Vulkan 1.4.341, LEONIDA_VK_VALIDATION=1):

  • d3d12_dsv_readonly, dsv_readonly_replay, d3d12_state_map, replay_state_cache: 4/4 passed.
  • Sync validation (VK_VALIDATE_SYNC=1): d3d12_dsv_readonly and replay_state_cache 2/2 passed.
  • python -I scripts/check_no_game_data.py: passed; git merge-tree --write-tree origin/main HEAD: clean.

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7289986418 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7289986418). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-30T19:49:16Z. --- Fixed the `replay_state_cache` CI failure in `a04eff9a4b`: - Updated `replay_state_cache_test.cpp`'s read-only DSV CPU mock to provide a pipeline `variant` callback and `separate_depth_stencil_attachment_access = true` (matching the `GENERAL` layout path it asserts). - Updated both live-GPU read-only depth tests in `replay_state_cache_test.cpp` to mark the read-only pipelines' `depth_writes` / `stencil_writes` accurately and pass the device's `VK_KHR_maintenance7` `separateDepthStencilAttachmentAccess` property into `VulkanContext` (falling back to `D32_SFLOAT` when the device lacks separate attachment access). Verified locally on Windows 11, MSVC 19.44, NVIDIA GeForce RTX 5070 12 GB (driver 610.88, Vulkan 1.4.341, `LEONIDA_VK_VALIDATION=1`): - `d3d12_dsv_readonly`, `dsv_readonly_replay`, `d3d12_state_map`, `replay_state_cache`: 4/4 passed. - Sync validation (`VK_VALIDATE_SYNC=1`): `d3d12_dsv_readonly` and `replay_state_cache` 2/2 passed. - `python -I scripts/check_no_game_data.py`: passed; `git merge-tree --write-tree origin/main HEAD`: clean. AI-assisted (Antigravity, Gemini).
ammonium231 commented 2026-11-30 22:22:52 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ammonium231 on 2026-11-30T22:22:52Z.


Re-run at a04eff9a4 on main a596adfac: d3d12_dsv_readonly OK, 0 validation errors (PR-only); dsv_readonly_replay 12 checks passed (PR-only); d3d12_depth24_draw 0 failure(s) (main 0 failure(s)); replay_state_cache ALL PASS (main ALL PASS); d3d12_state_map OK (main OK). No validation errors.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7293768178 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7293768178). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-11-30T22:22:52Z. --- Re-run at a04eff9a4 on main a596adfac: d3d12_dsv_readonly OK, 0 validation errors (PR-only); dsv_readonly_replay 12 checks passed (PR-only); d3d12_depth24_draw 0 failure(s) (main 0 failure(s)); replay_state_cache ALL PASS (main ALL PASS); d3d12_state_map OK (main OK). No validation errors.
aslan2142 commented 2026-12-02 00:44:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-02T00:44:26Z.


Thank you for the careful work and thorough verification here. The legacy C++/Vulkan runtime/ directory is now frozen and deprecated as active development focuses on the d3d12/ and clean-room Rust vulkan/ tracks, so we are closing open legacy runtime/ PRs. We really appreciate the effort that went into this.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7330903526 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2480#issuecomment-7330903526). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-02T00:44:26Z. --- Thank you for the careful work and thorough verification here. The legacy C++/Vulkan runtime/ directory is now frozen and deprecated as active development focuses on the d3d12/ and clean-room Rust vulkan/ tracks, so we are closing open legacy runtime/ PRs. We really appreciate the effort that went into this.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2480
No description provided.