vulkan_replay: clear packed 16-bit UAV textures (VK-UAV-CLEAR-PACK16) #907

Manually merged
github merged 1 commit from gh-pr/907/head into gh-pr/907/base 2026-11-26 09:27:32 +00:00
Owner

@⁠TheGeogeo on GitHub · 2026-11-24 15:09 UTC · original
TheGeogeo:fix/uav-clear-pack16 → main · +104 −0 · 3 files · 1 commits · merged 2026-11-24 20:44 UTC

Claimed in the coordination issue as: VK-UAV-CLEAR-PACK16

What and why

runtime/src/uav_clear.h had no layout for R5G6B5, A1R5G5B5 and A4R4G4B4 _UNORM_PACK16 (D3D12 B5G6R5, B5G5R5A1 and B4G4R4A4). ClearUnorderedAccessViewFloat/Uint on such a texture recorded fine, then uav_clear::encode refused it at replay, replay returned unsupported and ExecuteCommandLists dropped the whole submission.

The path measured here is B5G5R5A1_UNORM with ALLOW_UNORDERED_ACCESS on a GPU without native storage for it: the layer backs it with R16_UINT, and its UAV clear still names A1R5G5B5.

The three rows go next to the existing R4G4B4A4 one. WARP supports typed UAV stores and clears for all three formats, and the expected words in the tests come from WARP.

Tested

After a rebase on main 6293c1c4 (b67109eb, same patch as ebfcce66), on Windows 11, MSVC 19.52.37029, RTX 3080, driver 621.24: full ctest -j 1 --timeout 300 257 passed, 3 failed, 12 skipped, gameinput disabled. d3d12_uav_clear, d3d12_short_uav_clear, d3d12_b5g5r5a1_uav and replay_uav_clear_offset passed. The failures are the same three as in the first run below (#954 is open for the two indirect RT tests, #1066 for d3d12_execute_indirect_validation), and the skipped tests are the 12 listed there. The XMA2 decoder was not built on this PC.

Windows 11, MSVC 19.52, main f3e26be7 for the baseline and 3d3770c1 plus this change (rebased on a2892784, where the only new commit is a docs link).

  • New CPU regression in replay_uav_clear_offset_test (real replay() with fake Vulkan functions). Against the old header it exits 1 with 25 FAIL: lines, 8 for each format plus the R16_UINT-backed render target. With the fix it passes. It checks five Float clears and one Uint clear per format, a clear of an image in the format itself, and a decode/encode round trip of all 65536 words.
  • ctest -R uav_clear: 3 of 3 passed, including d3d12_uav_clear (three added literals) and d3d12_short_uav_clear. d3d12_uav_clear skips its A4B4G4R4 device clears here because the device reports no typed UAV for it.
  • Scratch GPU check, not in the diff: a copy of d3d12_b5g5r5a1_uav_test with a whole-view Float clear and a rectangle Uint clear. Before: ExecuteCommandLists failed: unsupported; nothing was submitted. After: exit 0, every texel matches WARP (a2ec, 8443).
  • Full ctest: same results as the baseline, 255 passed and the same three failures (d3d12_execute_indirect_validation, d3d12_indirect_rt, d3d12_indirect_rt_upload_sysmem). Skipped: shader_library_corpus, bink_decode, bink_abi, bink_play_headless, fsr_dispatch, bvh_builder, bink_audio, vk_sync_validation, d3d12_sparse_queue_family_contract, d3d12_rgb9e5_rtv, d3d12_boot_movie, d3d12_first_light. Disabled: gameinput.
  • git diff --check and python -I scripts/check_no_game_data.py on the three files: clean.

Not covered: B5G6R5 and B4G4R4A4 on a GPU (checked on the CPU against WARP words only; which Vulkan drivers have native storage for them was not measured), the Vulkan validation layer, GCC and Clang, and the tests that need glslangValidator, llvm-mc or the SPIR-V tools. Merging #418 onto this branch is clean; #261 conflicts with main itself in three other files.

GPUs tested: NVIDIA GeForce RTX 3080, driver 621.24, Windows 11

AI-assisted: yes (Claude Code)

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 (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md: not applicable.
**@⁠TheGeogeo** on GitHub · 2026-11-24 15:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/907) `TheGeogeo:fix/uav-clear-pack16` → `main` · +104 −0 · 3 files · 1 commits · merged 2026-11-24 20:44 UTC Claimed in the coordination issue as: [VK-UAV-CLEAR-PACK16](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why `runtime/src/uav_clear.h` had no layout for `R5G6B5`, `A1R5G5B5` and `A4R4G4B4` `_UNORM_PACK16` (D3D12 `B5G6R5`, `B5G5R5A1` and `B4G4R4A4`). `ClearUnorderedAccessViewFloat/Uint` on such a texture recorded fine, then `uav_clear::encode` refused it at replay, `replay` returned `unsupported` and `ExecuteCommandLists` dropped the whole submission. The path measured here is `B5G5R5A1_UNORM` with `ALLOW_UNORDERED_ACCESS` on a GPU without native storage for it: the layer backs it with `R16_UINT`, and its UAV clear still names `A1R5G5B5`. The three rows go next to the existing `R4G4B4A4` one. WARP supports typed UAV stores and clears for all three formats, and the expected words in the tests come from WARP. ### Tested After a rebase on `main` `6293c1c4` (`b67109eb`, same patch as `ebfcce66`), on Windows 11, MSVC 19.52.37029, RTX 3080, driver 621.24: full `ctest -j 1 --timeout 300` 257 passed, 3 failed, 12 skipped, `gameinput` disabled. `d3d12_uav_clear`, `d3d12_short_uav_clear`, `d3d12_b5g5r5a1_uav` and `replay_uav_clear_offset` passed. The failures are the same three as in the first run below (#954 is open for the two indirect RT tests, #1066 for `d3d12_execute_indirect_validation`), and the skipped tests are the 12 listed there. The XMA2 decoder was not built on this PC. Windows 11, MSVC 19.52, `main` f3e26be7 for the baseline and 3d3770c1 plus this change (rebased on a2892784, where the only new commit is a docs link). - New CPU regression in `replay_uav_clear_offset_test` (real `replay()` with fake Vulkan functions). Against the old header it exits 1 with 25 `FAIL:` lines, 8 for each format plus the `R16_UINT`-backed render target. With the fix it passes. It checks five Float clears and one Uint clear per format, a clear of an image in the format itself, and a decode/encode round trip of all 65536 words. - `ctest -R uav_clear`: 3 of 3 passed, including `d3d12_uav_clear` (three added literals) and `d3d12_short_uav_clear`. `d3d12_uav_clear` skips its A4B4G4R4 device clears here because the device reports no typed UAV for it. - Scratch GPU check, not in the diff: a copy of `d3d12_b5g5r5a1_uav_test` with a whole-view Float clear and a rectangle Uint clear. Before: `ExecuteCommandLists failed: unsupported; nothing was submitted`. After: exit 0, every texel matches WARP (`a2ec`, `8443`). - Full `ctest`: same results as the baseline, 255 passed and the same three failures (`d3d12_execute_indirect_validation`, `d3d12_indirect_rt`, `d3d12_indirect_rt_upload_sysmem`). Skipped: `shader_library_corpus`, `bink_decode`, `bink_abi`, `bink_play_headless`, `fsr_dispatch`, `bvh_builder`, `bink_audio`, `vk_sync_validation`, `d3d12_sparse_queue_family_contract`, `d3d12_rgb9e5_rtv`, `d3d12_boot_movie`, `d3d12_first_light`. Disabled: `gameinput`. - `git diff --check` and `python -I scripts/check_no_game_data.py` on the three files: clean. Not covered: `B5G6R5` and `B4G4R4A4` on a GPU (checked on the CPU against WARP words only; which Vulkan drivers have native storage for them was not measured), the Vulkan validation layer, GCC and Clang, and the tests that need `glslangValidator`, `llvm-mc` or the SPIR-V tools. Merging #418 onto this branch is clean; #261 conflicts with `main` itself in three other files. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.24, Windows 11 AI-assisted: yes (Claude Code) ### 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 (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`: not applicable.
uav_clear.h had no layout for R5G6B5, A1R5G5B5 and A4R4G4B4 (D3D12 B5G6R5,
B5G5R5A1 and B4G4R4A4), so ClearUnorderedAccessView on such a texture was
refused at replay and the whole submission was dropped.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:27:32 +00:00
github manually merged commit b67109eb3e into gh-pr/907/base 2026-11-26 09:27:32 +00:00
Author
Owner

@⁠SweatierKey on GitHub · 2026-11-24 15:18 UTC · original · approved these changes

Independent hardware verification on NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11, Vulkan 1.4) against origin/main@a28927849:

  • Built d3d12_uav_clear_test.exe and replay_uav_clear_offset_test.exe (clang-cl + xwin SDK 10.0.26100) and ran natively on Windows 11 + RTX 5070 Ti:
    • d3d12_uav_clear_test.exe: ClearUnorderedAccessViewUint/Float: raw, structured and typed buffers and 2D, array and volume textures, whole views and rectangles, all matched (rc=0, includes the new B5G6R5/B5G5R5A1/B4G4R4A4 conversion checks).
    • replay_uav_clear_offset_test.exe: replay_uav_clear_offset: buffer offsets and typeless texture view-format clears all passed (rc=0, includes exhaustive 65,536-word decode/encode round-trips and R16_UINT-backed render target clear for B5G5R5A1).
  • python3 -I scripts/check_no_game_data.py: clean.

GPUs tested: NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11)
AI-assisted: yes

**@⁠SweatierKey** on GitHub · 2026-11-24 15:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/907#pullrequestreview-6042025649) · **approved these changes** Independent hardware verification on **NVIDIA GeForce RTX 5070 Ti** (driver 616.92, Windows 11, Vulkan 1.4) against `origin/main@a28927849`: - Built `d3d12_uav_clear_test.exe` and `replay_uav_clear_offset_test.exe` (`clang-cl` + xwin SDK 10.0.26100) and ran natively on Windows 11 + RTX 5070 Ti: - `d3d12_uav_clear_test.exe`: `ClearUnorderedAccessViewUint/Float: raw, structured and typed buffers and 2D, array and volume textures, whole views and rectangles, all matched` (`rc=0`, includes the new `B5G6R5`/`B5G5R5A1`/`B4G4R4A4` conversion checks). - `replay_uav_clear_offset_test.exe`: `replay_uav_clear_offset: buffer offsets and typeless texture view-format clears all passed` (`rc=0`, includes exhaustive 65,536-word decode/encode round-trips and `R16_UINT`-backed render target clear for `B5G5R5A1`). - `python3 -I scripts/check_no_game_data.py`: clean. GPUs tested: NVIDIA GeForce RTX 5070 Ti (driver 616.92, Windows 11) AI-assisted: yes
Author
Owner

@⁠Timon360SB on GitHub · 2026-11-24 15:34 UTC · original

Independent verification — Turing and Blackwell

Baseline: a28927849adb4e40dfdec8c32fb6758dcd205a37

PR head: ebfcce666800dd57954c833001b571fc5dce85ca

Environment

Configuration RTX 2060 SUPER RTX 5070
Architecture Turing Blackwell
NVIDIA driver 621.14 621.14
Windows 11 build 28000 26200
Windows SDK 10.0.28000.0 10.0.26100.0
Vulkan SDK 1.4.363.0 1.4.363.0
MSVC 19.44.35230 19.44.35230
Configuration RelWithDebInfo RelWithDebInfo
Generator Ninja Multi-Config Ninja Multi-Config

Core, GPU-assisted and synchronization validation enabled.

Three repetitions per revision on each GPU.

CTest results

Test 2060S BASE 2060S HEAD 5070 BASE 5070 HEAD
d3d12_uav_clear 3/3 3/3 3/3 3/3
d3d12_short_uav_clear 3/3 3/3 3/3 3/3
d3d12_b5g5r5a1_uav 3/3 3/3 3/3 3/3
replay_uav_clear_offset 3/3 3/3 3/3 3/3
vk_sync_validation 3/3 3/3 3/3 3/3

Total: 60/60 passed, 0 failed, 0 CTest skips.

Packed-format regression coverage

All new packed-format conversion and replay checks pass on both systems, including exhaustive decode/encode round trips for:

  • B5G6R5_UNORM
  • B5G5R5A1_UNORM
  • B4G4R4A4_UNORM

All 65,536 packed words per format are covered by each HEAD replay test.

Hardware observations

Both GPUs reported:

B5G5R5A1_UNORM UAV unavailable natively,
using mutable R16_UINT; format 86

The existing B5G5R5A1 resource test passed on both revisions:

R16_UINT image, A1R5G5B5 render-target clears
64x32 matched, UAV/SRV T# format 134,
0 validation errors

The short UAV clear tests matched:

  • 175 portable cases against host and literal bytes.
  • 15 WARP-only out-of-row controls.
  • 8 WARP-only UNORM midpoint controls.

A4B4G4R4 typed UAV device clears were internally skipped on both GPUs because the capability was unavailable.

Vulkan validation

All 12 synchronization validation positive controls passed.

Each positive control detected the deliberate unsynchronized copy hazard and reported zero errors after adding the barrier.

No unexpected Vulkan validation errors were observed in the selected test logs.

Conclusion

  • New packed-format conversion and replay regression checks pass on Turing and Blackwell.
  • Existing UAV and render-target tests remain green.
  • No regressions observed in the selected tests.
  • Validation-enabled coverage added on both architectures.

The new regression assertions are absent from BASE.
The existing B5G5R5A1 GPU test covers render-target clears and descriptor handling, not the author's separate scratch GPU UAV-clear regression.

Synthetic fixtures only. No game files used.

AI-assisted test automation and result analysis.

**@⁠Timon360SB** on GitHub · 2026-11-24 15:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/907#issuecomment-7136262577) ## Independent verification — Turing and Blackwell **Baseline:** `a28927849adb4e40dfdec8c32fb6758dcd205a37` **PR head:** `ebfcce666800dd57954c833001b571fc5dce85ca` ### Environment | Configuration | RTX 2060 SUPER | RTX 5070 | | --- | --- | --- | | Architecture | Turing | Blackwell | | NVIDIA driver | 621.14 | 621.14 | | Windows 11 build | 28000 | 26200 | | Windows SDK | 10.0.28000.0 | 10.0.26100.0 | | Vulkan SDK | 1.4.363.0 | 1.4.363.0 | | MSVC | 19.44.35230 | 19.44.35230 | | Configuration | RelWithDebInfo | RelWithDebInfo | | Generator | Ninja Multi-Config | Ninja Multi-Config | Core, GPU-assisted and synchronization validation enabled. Three repetitions per revision on each GPU. ### CTest results | Test | 2060S BASE | 2060S HEAD | 5070 BASE | 5070 HEAD | | --- | --- | --- | --- | --- | | `d3d12_uav_clear` | 3/3 | 3/3 | 3/3 | 3/3 | | `d3d12_short_uav_clear` | 3/3 | 3/3 | 3/3 | 3/3 | | `d3d12_b5g5r5a1_uav` | 3/3 | 3/3 | 3/3 | 3/3 | | `replay_uav_clear_offset` | 3/3 | 3/3 | 3/3 | 3/3 | | `vk_sync_validation` | 3/3 | 3/3 | 3/3 | 3/3 | **Total: 60/60 passed, 0 failed, 0 CTest skips.** ### Packed-format regression coverage All new packed-format conversion and replay checks pass on both systems, including exhaustive decode/encode round trips for: - B5G6R5_UNORM - B5G5R5A1_UNORM - B4G4R4A4_UNORM All 65,536 packed words per format are covered by each HEAD replay test. ### Hardware observations Both GPUs reported: ```text B5G5R5A1_UNORM UAV unavailable natively, using mutable R16_UINT; format 86 ``` The existing B5G5R5A1 resource test passed on both revisions: ```text R16_UINT image, A1R5G5B5 render-target clears 64x32 matched, UAV/SRV T# format 134, 0 validation errors ``` The short UAV clear tests matched: - 175 portable cases against host and literal bytes. - 15 WARP-only out-of-row controls. - 8 WARP-only UNORM midpoint controls. A4B4G4R4 typed UAV device clears were internally skipped on both GPUs because the capability was unavailable. ### Vulkan validation All 12 synchronization validation positive controls passed. Each positive control detected the deliberate unsynchronized copy hazard and reported zero errors after adding the barrier. No unexpected Vulkan validation errors were observed in the selected test logs. ### Conclusion - New packed-format conversion and replay regression checks pass on Turing and Blackwell. - Existing UAV and render-target tests remain green. - No regressions observed in the selected tests. - Validation-enabled coverage added on both architectures. The new regression assertions are absent from BASE. The existing B5G5R5A1 GPU test covers render-target clears and descriptor handling, not the author's separate scratch GPU UAV-clear regression. Synthetic fixtures only. No game files used. AI-assisted test automation and result analysis.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-24 20:44 UTC · original

Merging.

Why merged: VK-UAV-CLEAR-PACK16: B5G6R5, B5G5R5A1 and B4G4R4A4 join the UAV-clear layout table, with conversion checks and an exhaustive 65,536-word round trip. Timon360SB (2060S and 5070, 60/60) and SweatierKey approved. The current head b67109eb3 is a content-identical rebase of the reviewed one.

Why it's good: uav_clear, short_uav_clear, b5g5r5a1_uav and replay_uav_clear_offset all pass both plain and under validation.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #517, #907, #927, #954 and #1074 merged onto main 32a5d9698 (after aslan2142's runtime merges). There the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The 2 failures are d3d12_depth_resolve (pre-existing) and d3d12_close_parity, which fails on plain 32a5d9698 too: a regression from #510, reported there, not from these PRs. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

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

**@⁠QemmHD** on GitHub · 2026-11-24 20:44 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/907#issuecomment-7143985531) Merging. **Why merged:** VK-UAV-CLEAR-PACK16: B5G6R5, B5G5R5A1 and B4G4R4A4 join the UAV-clear layout table, with conversion checks and an exhaustive 65,536-word round trip. Timon360SB (2060S and 5070, 60/60) and SweatierKey approved. The current head b67109eb3 is a content-identical rebase of the reviewed one. **Why it's good:** uav_clear, short_uav_clear, b5g5r5a1_uav and replay_uav_clear_offset all pass both plain and under validation. Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #517, #907, #927, #954 and #1074 merged onto main 32a5d9698 (after aslan2142's runtime merges). There the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The 2 failures are d3d12_depth_resolve (pre-existing) and d3d12_close_parity, which fails on plain 32a5d9698 too: a regression from #510, reported there, not from these PRs. git merge-tree against current main: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.