d3d12: support 3D depth resources and slice clears #1128

Closed
github-bot wants to merge 1 commit from gh-pr/1128/head into gh-pr/1128/base
Owner

@⁠bobcatchris on GitHub · 2026-11-24 18:58 UTC · original
bobcatchris:fix/3d-depth-resource → main · +190 −19 · 6 files · 1 commits · closed without merging

Claimed in the coordination issue as: D3D-3D-DEPTH-RESOURCE

Depends on: none

Fixes: none

What and why

Native D3D12 accepts a single-sample TEXTURE3D resource with ALLOW_DEPTH_STENCIL, while Leonida refused it in both format selection and allocation validation. This removes those refusals, creates Vulkan 3D depth images with VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT, allows depth/stencil aspects in volume subresource ranges, and clears a partial-volume DSV through a 2D-array attachment view instead of incorrectly clearing the whole volume. Typeless depth attachment views now request depth/stencil usage rather than color-attachment usage. Original finding and Vulkan feasibility evidence by @⁠Dezmonius.

Tested

  • Baseline replay_clear_gate_test with the new cases: 3 failures (slice clear path, selected W slice, whole-volume path).
  • Patched replay_clear_gate_test: passes.
  • Patched full runtime build (gta6rt, TLS host, d3d12_clear_test): succeeds with MSVC 19.44.
  • LEONIDA_VK_VALIDATION=1 d3d12_clear_test --volume: passes on RX 7900 XTX; the new 3D-depth case correctly skips because this AMD driver reports no support for the required 3D D16 format/usage/flags combination. Existing 3D RTV readback remains validation-clean.
  • ctest -R "^(replay_clear_gate|gfx10_descriptors)$": 2/2 passed.
  • Docs CLI-flag and link tests: 4/4 and 16/16 passed.
  • scripts/check_no_game_data.py: clean; patch security sweep: 0 hits.

GPUs tested: AMD Radeon RX 7900 XTX, driver 32.0.32029.2010, Windows 11 (new GPU case skipped: 3D D16 depth unsupported; CPU replay path and existing volume RTV validated)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption, including in logs or reports quoted here.
  • N/A — not a translator rule.
**@⁠bobcatchris** on GitHub · 2026-11-24 18:58 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1128) `bobcatchris:fix/3d-depth-resource` → `main` · +190 −19 · 6 files · 1 commits · closed without merging Claimed in the coordination issue as: D3D-3D-DEPTH-RESOURCE Depends on: none Fixes: none ### What and why Native D3D12 accepts a single-sample `TEXTURE3D` resource with `ALLOW_DEPTH_STENCIL`, while Leonida refused it in both format selection and allocation validation. This removes those refusals, creates Vulkan 3D depth images with `VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT`, allows depth/stencil aspects in volume subresource ranges, and clears a partial-volume DSV through a 2D-array attachment view instead of incorrectly clearing the whole volume. Typeless depth attachment views now request depth/stencil usage rather than color-attachment usage. Original finding and Vulkan feasibility evidence by @⁠Dezmonius. ### Tested - Baseline `replay_clear_gate_test` with the new cases: 3 failures (slice clear path, selected W slice, whole-volume path). - Patched `replay_clear_gate_test`: passes. - Patched full runtime build (`gta6rt`, TLS host, `d3d12_clear_test`): succeeds with MSVC 19.44. - `LEONIDA_VK_VALIDATION=1 d3d12_clear_test --volume`: passes on RX 7900 XTX; the new 3D-depth case correctly skips because this AMD driver reports no support for the required 3D D16 format/usage/flags combination. Existing 3D RTV readback remains validation-clean. - `ctest -R "^(replay_clear_gate|gfx10_descriptors)$"`: 2/2 passed. - Docs CLI-flag and link tests: 4/4 and 16/16 passed. - `scripts/check_no_game_data.py`: clean; patch security sweep: 0 hits. GPUs tested: AMD Radeon RX 7900 XTX, driver 32.0.32029.2010, Windows 11 (new GPU case skipped: 3D D16 depth unsupported; CPU replay path and existing volume RTV validated) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption, including in logs or reports quoted here. - [x] N/A — not a translator rule.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:39:30 +00:00
github-bot closed this pull request 2026-11-26 09:39:30 +00:00
Author
Owner

@⁠bobcatchris on GitHub · 2026-11-24 19:05 UTC · original

Closing as overlapping with earlier RT-VOLUME-DEPTH / #961. I missed that claim when selecting this target. Independent evidence for that PR: on Windows 11 / RX 7900 XTX / driver 32.0.32029.2010, a synthetic native D3D12 probe accepted a TEXTURE3D 4x4x4 R16_TYPELESS ALLOW_DEPTH_STENCIL resource and a TEXTURE2D DSV into it. @⁠Dezmonius also measured S_OK on WARP and RTX 5070 and a validation-clean raw Vulkan 3D D16 slice clear. That suggests the PC refusal may be runtime/driver-specific, but the retail sizing/creation stop is already owned by #961, so this global-layer PR should not proceed in parallel. No game data was used.

**@⁠bobcatchris** on GitHub · 2026-11-24 19:05 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1128#issuecomment-7141586813) Closing as overlapping with earlier RT-VOLUME-DEPTH / #961. I missed that claim when selecting this target. Independent evidence for that PR: on Windows 11 / RX 7900 XTX / driver 32.0.32029.2010, a synthetic native D3D12 probe accepted a TEXTURE3D 4x4x4 R16_TYPELESS ALLOW_DEPTH_STENCIL resource and a TEXTURE2D DSV into it. @⁠Dezmonius also measured S_OK on WARP and RTX 5070 and a validation-clean raw Vulkan 3D D16 slice clear. That suggests the PC refusal may be runtime/driver-specific, but the retail sizing/creation stop is already owned by #961, so this global-layer PR should not proceed in parallel. No game data was used.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.