D3D-CLEAR-UAV-3D-SLICE: clear selected 3D UAV slices and rectangles #1814

Manually merged
github merged 1 commit from gh-pr/1814/head into gh-pr/1814/base 2026-11-26 10:06:41 +00:00
Owner

@⁠timbot103 on GitHub · 2026-11-25 12:27 UTC · original
timbot103:d3d-clear-uav-3d-slice → main · +757 −76 · 9 files · 1 commits · merged 2026-11-25 19:29 UTC

Claimed in the coordination issue as: D3D-CLEAR-UAV-3D-SLICE

What and why

ClearUnorderedAccessViewUint and ClearUnorderedAccessViewFloat can now clear selected W slices of a 3D texture mip and apply XY rectangles to each selected slice. A tagged descriptor carries the W range through a descriptor copy. An untagged descriptor uses the bound resource's mip depth, and an unpredicated whole-mip clear uses the existing fast path.

The staged path fills up to 64 KiB of scratch once and reuses the pattern across tiles and slices. It supports direct and compute queues, clips rectangles to the mip, and orders overlapping writes. It refuses predicated staged clears and incompatible 3D view/backing formats. The existing packed RGB9E5 representation on R32_UINT is supported.

Tested

  • Built all 11 UAV/clear/replay test binaries and linked gta6rt with MSVC 2022, Ninja and RelWithDebInfo. A clean build matched the warning set on unmodified 0d80bc5df.
  • Ran 14 invocations on each GPU with Khronos validation and synchronization validation enabled and disabled. Across the four configurations, 52 invocations passed, two skipped and two failed. There were zero Vulkan validation errors.
  • Native D3D12 WARP and Vulkan produced identical Uint and Float readbacks for partial W clears and rectangles at mip 1. The comparison covered every texel on direct and dedicated compute queues, including the adjacent slices and mip. The full texture UAV test also passed 14 GPU cases, 10 compared with WARP, on both GPUs.
  • Both GPUs accepted a predicate on direct and compute lists using the graphics family, then refused a predicated staged clear. On the dedicated compute families the existing backend refused predicate capture before clear replay.
  • Regression controls caught both undersized and oversized untagged descriptor depths. Omitting the mip-1 RGB9E5 Uint write left 48 incorrect bytes in the seeded slice.
  • The RTX 5080 skipped the native RGB9E5 render-target probe in both modes. Radeon failed the existing default D32 NaN depth-clear test in both modes (15 texels read 1, WARP expected NaN). Both outcomes reproduced on unmodified 0d80bc5df. The 3D UAV clear tests passed in all four configurations.

GPUs tested: NVIDIA GeForce RTX 5080, driver 616.64, Vulkan 1.4.351; AMD Radeon(TM) Graphics, driver 25.10.30.02 (Windows 32.0.21030.2001), Vulkan 1.4.315. Both on Windows 11 Pro build 26200.

AI-assisted: yes (Gemini, Codex, Claude)

Checklist

  • Based on current main at 0d80bc5df.
  • One topic, 3D UAV clear ranges and rectangles.
  • No game data, keys or decryption. The repository content check passed for every changed file.
  • Translator contract table — not applicable to this runtime-only change.
**@⁠timbot103** on GitHub · 2026-11-25 12:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1814) `timbot103:d3d-clear-uav-3d-slice` → `main` · +757 −76 · 9 files · 1 commits · merged 2026-11-25 19:29 UTC Claimed in the coordination issue as: [D3D-CLEAR-UAV-3D-SLICE](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### What and why `ClearUnorderedAccessViewUint` and `ClearUnorderedAccessViewFloat` can now clear selected W slices of a 3D texture mip and apply XY rectangles to each selected slice. A tagged descriptor carries the W range through a descriptor copy. An untagged descriptor uses the bound resource's mip depth, and an unpredicated whole-mip clear uses the existing fast path. The staged path fills up to 64 KiB of scratch once and reuses the pattern across tiles and slices. It supports direct and compute queues, clips rectangles to the mip, and orders overlapping writes. It refuses predicated staged clears and incompatible 3D view/backing formats. The existing packed RGB9E5 representation on R32_UINT is supported. ### Tested - Built all 11 UAV/clear/replay test binaries and linked `gta6rt` with MSVC 2022, Ninja and `RelWithDebInfo`. A clean build matched the warning set on unmodified `0d80bc5df`. - Ran 14 invocations on each GPU with Khronos validation and synchronization validation enabled and disabled. Across the four configurations, 52 invocations passed, two skipped and two failed. There were zero Vulkan validation errors. - Native D3D12 WARP and Vulkan produced identical Uint and Float readbacks for partial W clears and rectangles at mip 1. The comparison covered every texel on direct and dedicated compute queues, including the adjacent slices and mip. The full texture UAV test also passed 14 GPU cases, 10 compared with WARP, on both GPUs. - Both GPUs accepted a predicate on direct and compute lists using the graphics family, then refused a predicated staged clear. On the dedicated compute families the existing backend refused predicate capture before clear replay. - Regression controls caught both undersized and oversized untagged descriptor depths. Omitting the mip-1 RGB9E5 Uint write left 48 incorrect bytes in the seeded slice. - The RTX 5080 skipped the native RGB9E5 render-target probe in both modes. Radeon failed the existing default D32 NaN depth-clear test in both modes (15 texels read `1`, WARP expected NaN). Both outcomes reproduced on unmodified `0d80bc5df`. The 3D UAV clear tests passed in all four configurations. GPUs tested: NVIDIA GeForce RTX 5080, driver 616.64, Vulkan 1.4.351; AMD Radeon(TM) Graphics, driver 25.10.30.02 (Windows 32.0.21030.2001), Vulkan 1.4.315. Both on Windows 11 Pro build 26200. AI-assisted: yes (Gemini, Codex, Claude) ### Checklist - [x] Based on current `main` at `0d80bc5df`. - [x] One topic, 3D UAV clear ranges and rectangles. - [x] No game data, keys or decryption. The repository content check passed for every changed file. - [x] Translator contract table — not applicable to this runtime-only change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:06:39 +00:00
github manually merged commit 926e9d3ef3 into gh-pr/1814/base 2026-11-26 10:06:41 +00:00
Author
Owner

@⁠madvillain91 on GitHub · 2026-11-25 14:56 UTC · original · reviewed

Reviewed diff and independently verified commit 926e9d3ef on Windows 11 with an NVIDIA Ampere GPU (against main 71a769d7d):

Environment

  • OS: Windows 11 26H2 (build 26300.9711)
  • Compiler: VS 2022 Build Tools (MSVC 19.44.35230.0, Ninja, RelWithDebInfo)
  • Vulkan SDK: 1.4.363.0
  • GPU: NVIDIA GeForce RTX 3070 Ti (Ampere, 8192 MiB), driver 617.14, Vulkan 1.4.351

Checks run

  • git diff --check: clean
  • Built replay_uav_clear_offset_test, d3d12_uav_clear_test, and d3d12_texture_uav_test cleanly in an isolated build: 0 errors
  • replay_uav_clear_offset_test: PASS (buffer offsets, typeless texture view-format clears, and 3D sliced/rect clears all passed)
  • d3d12_uav_clear_test (plain, LEONIDA_VK_VALIDATION=1, and LEONIDA_VK_VALIDATION=1 + VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT): PASS, 0 VUIDs across all 3 modes (A4B4G4R4_UNORM skipped as no typed UAV on this device; 3D UAV predication predicate control passed and staged clear refused on both direct family 0 and compute family 0)
  • d3d12_texture_uav_test --descriptors-only (LEONIDA_VK_VALIDATION=1 and LEONIDA_VK_VALIDATION=1 + synchronization validation): PASS, 0 VUIDs (texture UAV descriptors: creation, copy, range/refusal and clear checks passed)

Diff notes

  • volume_clear_tile() keeps every tile pattern within the 64 KiB vkCmdUpdateBuffer limit and reuses the private scratch buffer across disjoint XY tiles and Z slices; emit_commands() inserts a transfer barrier before each clipped rectangle to order overlapping rects and scratch fill/update.
  • clear_unordered_access() restricts to DIRECT/COMPUTE lists, and untagged 3D T#s derive mip depth from resource->GetDesc().DepthOrArraySize >> first_mip rather than raw descriptor depth.
  • Predicated staged clears and incompatible 3D view/backing formats (except emulated R9G9B9E5 on R32_UINT) are cleanly refused before submission.

Not checked

  • Full d3d12_texture_uav_test <cs_texture_uav.spv> compute shader invocation, full ctest suite, and non-NVIDIA hardware.

LGTM from this Windows 11 + NVIDIA RTX 3070 Ti verification (AI-assisted verification; synthetic test fixtures only, no game data).

**@⁠madvillain91** on GitHub · 2026-11-25 14:56 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1814#pullrequestreview-6059983783) · **reviewed** Reviewed diff and independently verified commit `926e9d3ef` on Windows 11 with an NVIDIA Ampere GPU (against `main` `71a769d7d`): ### Environment - OS: Windows 11 26H2 (build 26300.9711) - Compiler: VS 2022 Build Tools (MSVC `19.44.35230.0`, Ninja, `RelWithDebInfo`) - Vulkan SDK: `1.4.363.0` - GPU: NVIDIA GeForce RTX 3070 Ti (Ampere, 8192 MiB), driver `617.14`, Vulkan `1.4.351` ### Checks run - `git diff --check`: clean - Built `replay_uav_clear_offset_test`, `d3d12_uav_clear_test`, and `d3d12_texture_uav_test` cleanly in an isolated build: 0 errors - `replay_uav_clear_offset_test`: **PASS** (`buffer offsets, typeless texture view-format clears, and 3D sliced/rect clears all passed`) - `d3d12_uav_clear_test` (plain, `LEONIDA_VK_VALIDATION=1`, and `LEONIDA_VK_VALIDATION=1` + `VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT`): **PASS, 0 VUIDs** across all 3 modes (`A4B4G4R4_UNORM` skipped as no typed UAV on this device; `3D UAV predication` predicate control passed and staged clear refused on both direct family 0 and compute family 0) - `d3d12_texture_uav_test --descriptors-only` (`LEONIDA_VK_VALIDATION=1` and `LEONIDA_VK_VALIDATION=1` + synchronization validation): **PASS, 0 VUIDs** (`texture UAV descriptors: creation, copy, range/refusal and clear checks passed`) ### Diff notes - `volume_clear_tile()` keeps every tile pattern within the 64 KiB `vkCmdUpdateBuffer` limit and reuses the private scratch buffer across disjoint XY tiles and Z slices; `emit_commands()` inserts a transfer barrier before each clipped rectangle to order overlapping rects and scratch fill/update. - `clear_unordered_access()` restricts to `DIRECT`/`COMPUTE` lists, and untagged 3D T#s derive mip depth from `resource->GetDesc().DepthOrArraySize >> first_mip` rather than raw descriptor depth. - Predicated staged clears and incompatible 3D view/backing formats (except emulated `R9G9B9E5` on `R32_UINT`) are cleanly refused before submission. ### Not checked - Full `d3d12_texture_uav_test <cs_texture_uav.spv>` compute shader invocation, full `ctest` suite, and non-NVIDIA hardware. LGTM from this Windows 11 + NVIDIA RTX 3070 Ti verification (AI-assisted verification; synthetic test fixtures only, no game data).
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 19:29 UTC · original

Merged, thanks! Tested 926e9d3ef merged onto main with the UAV area tests and the full Windows suite under Wine (llvmpipe and a RADV iGPU). The full suite matches main test by test. The d3d12_clear and d3d12_view_slices failures there fail on main too, with the same messages; they come from the headless test display.

  • Checked on main 75a41f5dc + 926e9d3ef: it merges cleanly; the semantic suite passes (491 files, 6,312 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 9 changed files.

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

**@⁠aslan2142** on GitHub · 2026-11-25 19:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1814#issuecomment-7172363743) Merged, thanks! Tested `926e9d3ef` merged onto `main` with the UAV area tests and the full Windows suite under Wine (llvmpipe and a RADV iGPU). The full suite matches `main` test by test. The `d3d12_clear` and `d3d12_view_slices` failures there fail on `main` too, with the same messages; they come from the headless test display. - **Checked on `main` `75a41f5dc` + `926e9d3ef`:** it merges cleanly; the semantic suite passes (491 files, 6,312 tests, 0 files failed); the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 9 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.