RT-STATE-AUDIT-FORMATS: quantize 16-bit packed UNORM and rgba4 fallback clears #2479

Closed
lixonik wants to merge 4 commits from upstream-pr/2479 into main
lixonik commented 2026-11-27 16:18:24 +00:00 (Migrated from github.com)

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


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

Summary

  • Add VK_FORMAT_A1R5G5B5_UNORM_PACK16, VK_FORMAT_A4R4G4B4_UNORM_PACK16, VK_FORMAT_R4G4B4A4_UNORM_PACK16, and VK_FORMAT_A4B4G4R4_UNORM_PACK16 to detail::render_target_clear_color in runtime/src/vulkan_replay.h so 16-bit packed UNORM clears follow D3D12 round-to-nearest-even, clamp, and NaN -> 0 rules across GPUs (VK_FORMAT_R5G6B5_UNORM_PACK16 is intentionally left untouched to avoid overlapping #2268).
  • Replace std::nearbyint(std::clamp(channel, 0.0f, 1.0f) * 15.0f) / 15.0f in the rgba4_render_fallback clear path (runtime/src/vulkan_replay.h) with detail::quantize_unorm(channel, 15.0) so 4-bit tie rounding and NaN handling do not depend on the thread's active floating-point rounding mode.

Tests

  • runtime/test/clear_color_test.cpp: added 16-bit packed UNORM clear quantization cases (A1R5G5B5, A4R4G4B4, R4G4B4A4, A4B4G4R4) and rgba4_render_fallback replay coverage under FE_DOWNWARD, FE_UPWARD, and FE_TOWARDZERO (full + rectangular clears, tie/clamp/NaN, including VK_FORMAT_UNDEFINED).
  • runtime/test/d3d12_b4g4r4a4_target_test.cpp: clear {0.5f, -1.0f, 2.0f, NaN} under FE_DOWNWARD and verify RGBA8 readback {0x88, 0x00, 0xFF, 0x00} (skips with 77 on GPUs with native A4R4G4B4 color attachment support).
  • runtime/test/d3d12_clear_formats_test.cpp: added B5G5R5A1_UNORM and A4B4G4R4_UNORM differential WARP cases.

Negative control & verification

  • On unmodified main (ec91d695c):
    • clear_color_test failed on A1R5G5B5 (got 0.5, expected 0.516129017).
    • d3d12_b4g4r4a4_target_test failed on RTX 5070 under FE_DOWNWARD (texel (8, 4) = 77 00 ff 00, want 88 00 ff 00).
    • d3d12_clear_formats_test failed on RTX 5070 vs WARP on 4 B5G5R5A1_UNORM cases (layer 0f, WARP 10 and layer ef, WARP f0).
  • With the fix:
    • ctest -R "^(clear_color|d3d12_b4g4r4a4_target|d3d12_b5g5r5a1_uav|d3d12_clear_formats)$": 4/4 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 + WARP; VK_LAYER_KHRONOS_validation not installed locally).

AI-assisted (Antigravity, Gemini).

Independent RTX 3080 Vulkan validation: all three focused CTests passed, including the RGBA8 fallback and the nonzero green outside the rect. Test report.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5529790520 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-27T16:18:24Z. --- Part of `RT-STATE-AUDIT-FORMATS` (#2464; based on the format-state audit notes in #1608 by `@kevincommits` and `@Tauwni`). ### Summary - Add `VK_FORMAT_A1R5G5B5_UNORM_PACK16`, `VK_FORMAT_A4R4G4B4_UNORM_PACK16`, `VK_FORMAT_R4G4B4A4_UNORM_PACK16`, and `VK_FORMAT_A4B4G4R4_UNORM_PACK16` to `detail::render_target_clear_color` in `runtime/src/vulkan_replay.h` so 16-bit packed UNORM clears follow D3D12 round-to-nearest-even, clamp, and `NaN -> 0` rules across GPUs (`VK_FORMAT_R5G6B5_UNORM_PACK16` is intentionally left untouched to avoid overlapping #2268). - Replace `std::nearbyint(std::clamp(channel, 0.0f, 1.0f) * 15.0f) / 15.0f` in the `rgba4_render_fallback` clear path (`runtime/src/vulkan_replay.h`) with `detail::quantize_unorm(channel, 15.0)` so 4-bit tie rounding and `NaN` handling do not depend on the thread's active floating-point rounding mode. ### Tests - `runtime/test/clear_color_test.cpp`: added 16-bit packed UNORM clear quantization cases (`A1R5G5B5`, `A4R4G4B4`, `R4G4B4A4`, `A4B4G4R4`) and `rgba4_render_fallback` replay coverage under `FE_DOWNWARD`, `FE_UPWARD`, and `FE_TOWARDZERO` (full + rectangular clears, tie/clamp/`NaN`, including `VK_FORMAT_UNDEFINED`). - `runtime/test/d3d12_b4g4r4a4_target_test.cpp`: clear `{0.5f, -1.0f, 2.0f, NaN}` under `FE_DOWNWARD` and verify RGBA8 readback `{0x88, 0x00, 0xFF, 0x00}` (skips with 77 on GPUs with native `A4R4G4B4` color attachment support). - `runtime/test/d3d12_clear_formats_test.cpp`: added `B5G5R5A1_UNORM` and `A4B4G4R4_UNORM` differential WARP cases. ### Negative control & verification - On unmodified `main` (`ec91d695c`): - `clear_color_test` failed on `A1R5G5B5` (`got 0.5, expected 0.516129017`). - `d3d12_b4g4r4a4_target_test` failed on RTX 5070 under `FE_DOWNWARD` (`texel (8, 4) = 77 00 ff 00, want 88 00 ff 00`). - `d3d12_clear_formats_test` failed on RTX 5070 vs WARP on 4 `B5G5R5A1_UNORM` cases (`layer 0f, WARP 10` and `layer ef, WARP f0`). - With the fix: - `ctest -R "^(clear_color|d3d12_b4g4r4a4_target|d3d12_b5g5r5a1_uav|d3d12_clear_formats)$"`: 4/4 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 + WARP; `VK_LAYER_KHRONOS_validation` not installed locally). AI-assisted (Antigravity, Gemini). Independent RTX 3080 Vulkan validation: all three focused CTests passed, including the RGBA8 fallback and the nonzero green outside the rect. [Test report](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7245647954).
djrolfes commented 2026-11-27 17:36:20 +00:00 (Migrated from github.com)

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


Independent Linux/Wine + NVIDIA RTX 3070 Ti review/test at e7d11f0da (merged cleanly on origin/main c0201a806, wine-11.22, NVIDIA 620.73.04). AI-assisted.

  • Diff looks clean: render_target_clear_color adds 16-bit packed UNORM quantization (A1R5G5B5, A4R4G4B4, R4G4B4A4, A4B4G4R4), and rgba4_render_fallback switches from std::nearbyint to detail::quantize_unorm(channel, 15.0) so clears are independent of FP rounding mode.
  • clear_color (native Linux build): PASSED (including all FP rounding modes and rgba4_render_fallback).
  • d3d12_b4g4r4a4_target (Wine/Vulkan RTX 3070 Ti): PASSED (RGBA8 image, render-target clears 64x32 matched, SRV T# format 136, 0 validation errors, including the FE_DOWNWARD clear test).
  • d3d12_clear_formats compiled and ran on Wine/RTX 3070 Ti (0 failed, 0 in formats the layer does not expose); host WARP comparison differs under Wine because Wine's D3D12 is not Microsoft WARP.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7224590236 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2479#issuecomment-7224590236). Originally posted by [djrolfes](https://github.com/djrolfes) on 2026-11-27T17:36:20Z. --- Independent Linux/Wine + NVIDIA RTX 3070 Ti review/test at `e7d11f0da` (merged cleanly on `origin/main` `c0201a806`, `wine-11.22`, NVIDIA `620.73.04`). AI-assisted. - Diff looks clean: `render_target_clear_color` adds 16-bit packed UNORM quantization (`A1R5G5B5`, `A4R4G4B4`, `R4G4B4A4`, `A4B4G4R4`), and `rgba4_render_fallback` switches from `std::nearbyint` to `detail::quantize_unorm(channel, 15.0)` so clears are independent of FP rounding mode. - `clear_color` (native Linux build): **PASSED** (including all FP rounding modes and `rgba4_render_fallback`). - `d3d12_b4g4r4a4_target` (Wine/Vulkan RTX 3070 Ti): **PASSED** (`RGBA8 image, render-target clears 64x32 matched, SRV T# format 136, 0 validation errors`, including the `FE_DOWNWARD` clear test). - `d3d12_clear_formats` compiled and ran on Wine/RTX 3070 Ti (`0 failed, 0 in formats the layer does not expose`); host WARP comparison differs under Wine because Wine's D3D12 is not Microsoft WARP.
MoonEyes commented 2026-11-27 18:40:53 +00:00 (Migrated from github.com)

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


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

RUN pr2479-court | 2026-11-27 | MoonEyes | AI-assisted: Claude Code (Claude Opus 5.5)
BASE:        main ec91d695c + PR #2479 (head e7d11f0da), 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:
  - clear_color_test: pass on the PR | fails on main: not checked yet
  - d3d12_b4g4r4a4_target_test: pass on the PR | fails on main: not checked yet
  - d3d12_clear_formats_test: pass on the PR | fails on main: not checked yet (the main build finished after this write-up; the tests have not been run on main yet; I will add the result)
GAME:        session=1 at 155 s | world entered at 210 s | last window >= 1 img/s ends at 317 s | 0 frames after world entry + 240 s | end: time limit (cap 330 s, ended at 334 s) | device loss: no (no fault report) | private RAM max 16153 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)
             w79 (main, same short recipe): world at 200 s, last window >= 1 img/s at 286 s, private RAM max 16583 MB, ended by the time limit (350 s)
             one run each (n=1); on main the spread of world entry on this recipe is about 165 to 200 s, so no conclusion on timings
VERDICT:     unit tests pass, check on main pending; game run clean to the time limit, no device loss; no timing conclusion (n=1)

Reading (marked):

  • MEASURED: the display stops after the world is entered (107 s after world entry for the last window >= 1 img/s here; 98 s on w77, 86 s on w79). Present on main too, not caused by this PR (finding https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7224692645).
  • 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 each main witness.

AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7225751194 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2479#issuecomment-7225751194). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T18:40:53Z. --- Tested for #2464 as Aslanek asked: unit tests and a game run on my machine; CI ignored for now as asked. ``` RUN pr2479-court | 2026-11-27 | MoonEyes | AI-assisted: Claude Code (Claude Opus 5.5) BASE: main ec91d695c + PR #2479 (head e7d11f0da), 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: - clear_color_test: pass on the PR | fails on main: not checked yet - d3d12_b4g4r4a4_target_test: pass on the PR | fails on main: not checked yet - d3d12_clear_formats_test: pass on the PR | fails on main: not checked yet (the main build finished after this write-up; the tests have not been run on main yet; I will add the result) GAME: session=1 at 155 s | world entered at 210 s | last window >= 1 img/s ends at 317 s | 0 frames after world entry + 240 s | end: time limit (cap 330 s, ended at 334 s) | device loss: no (no fault report) | private RAM max 16153 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) w79 (main, same short recipe): world at 200 s, last window >= 1 img/s at 286 s, private RAM max 16583 MB, ended by the time limit (350 s) one run each (n=1); on main the spread of world entry on this recipe is about 165 to 200 s, so no conclusion on timings VERDICT: unit tests pass, check on main pending; game run clean to the time limit, no device loss; no timing conclusion (n=1) ``` Reading (marked): - MEASURED: the display stops after the world is entered (107 s after world entry for the last window >= 1 img/s here; 98 s on w77, 86 s on w79). Present on main too, not caused by this PR (finding https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7224692645). - 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 each main witness. AI-assisted (Claude Code, Claude Opus 5.5)
MoonEyes commented 2026-11-27 19:49:09 +00:00 (Migrated from github.com)

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


Follow-up to my RUN above: the check on main is now done. Each of the three tests, built from this PR's test files on top of main ec91d695c's sources, fails on main and passes with the PR:

  • clear_color_test: fails on main | pass on the PR
  • d3d12_b4g4r4a4_target_test: fails on main | pass on the PR
  • d3d12_clear_formats_test: fails on main | pass on the PR

Same machine as above (RTX 4060 8 GB, NVIDIA 610.88, Windows 11). One correction to the RUN above: on main with this exact recipe the world entry was 195 and 200 s (two runs), not "about 165 to 200 s"; the 165-175 s runs had one setting changed. The rest of the RUN is unchanged.

AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7226901002 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7226901002). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T19:49:09Z. --- Follow-up to my RUN above: the check on main is now done. Each of the three tests, built from this PR's test files on top of main ec91d695c's sources, fails on main and passes with the PR: - clear_color_test: fails on main | pass on the PR - d3d12_b4g4r4a4_target_test: fails on main | pass on the PR - d3d12_clear_formats_test: fails on main | pass on the PR Same machine as above (RTX 4060 8 GB, NVIDIA 610.88, Windows 11). One correction to the RUN above: on main with this exact recipe the world entry was 195 and 200 s (two runs), not "about 165 to 200 s"; the 165-175 s runs had one setting changed. The rest of the RUN is unchanged. AI-assisted (Claude Code, Claude Opus 5.5)
Tauwni commented 2026-11-27 20:11:07 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-27T20:11:07Z.


Tested on a Mac under Wine (Apple M3, macOS 26.5.1, Wine 11.0 with its MoltenVK 1.4.1), merged onto main 43a9d562d. Profile S, no game files. (MEASURED, 1 run each)

Test Test file only on main With this PR
d3d12_b4g4r4a4_target fails (line 213: wrong == 0) passes
clear_color fails (format 8 rect 0 channel 0: got 0.5, expected 0.516129017) passes
d3d12_clear_formats fails fails, identically

d3d12_clear_formats also fails on plain main here: it needs WARP as its reference (WARP reference unavailable: differential test cannot run), which Wine lacks. Not this PR.

This matters on Macs in particular: MoltenVK has no A4R4G4B4 colour attachment, so rgba4_render_fallback is the path every Mac takes.

AI-assisted (Claude Code). Report only.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7227256828 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7227256828). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-27T20:11:07Z. --- Tested on a Mac under Wine (Apple M3, macOS 26.5.1, Wine 11.0 with its MoltenVK 1.4.1), merged onto `main` `43a9d562d`. Profile S, no game files. (MEASURED, 1 run each) | Test | Test file only on `main` | With this PR | |---|---|---| | `d3d12_b4g4r4a4_target` | fails (`line 213: wrong == 0`) | passes | | `clear_color` | fails (`format 8 rect 0 channel 0: got 0.5, expected 0.516129017`) | passes | | `d3d12_clear_formats` | fails | fails, identically | `d3d12_clear_formats` also fails on plain `main` here: it needs WARP as its reference (`WARP reference unavailable: differential test cannot run`), which Wine lacks. Not this PR. This matters on Macs in particular: MoltenVK has no A4R4G4B4 colour attachment, so `rgba4_render_fallback` is the path every Mac takes. AI-assisted (Claude Code). Report only.
timbot103 commented 2026-11-28 02:02:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-28T02:02:11Z.


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

Verification

  • Built clear_color_test, d3d12_b4g4r4a4_target_test, and d3d12_clear_formats_test.
  • clear_color_test: 525 checks passed.
  • d3d12_clear_formats_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_b4g4r4a4_target_test (LEONIDA_VK_VALIDATION=1): passed on RTX 5080 (RGBA8 fallback exercised, 0 validation errors); skipped (77) on AMD Radeon (native A4R4G4B4 attachment).

Notes (non-blocking)

  • Channel widths for 5:5:5:1 and 4:4:4:4 (logical RGBA order per VkClearColorValue), NaN/Inf clamping, and directed-rounding quantization for the RGBA8 fallback (vulkan_replay.h:1550-1567, 1637-1653, 4862-4894) all look right.
  • Minor follow-up note (vulkan_replay.h:1637-1653): DXGI_FORMAT_B5G6R5_UNORM (VK_FORMAT_R5G6B5_UNORM_PACK16) is also an exposed 16-bit packed UNORM RTV (d3d12_vulkan_device.cpp:2335-2338) and still falls through to driver rounding; fine as a follow-up if covering all 16-bit packed UNORM RTVs.

Approve.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7232084502 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7232084502). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T02:02:11Z. --- Reviewed at head `e7d11f0da` on Windows 11 (MSVC 2022 `19.44`) with dual-GPU Vulkan validation (`LEONIDA_VK_VALIDATION=1`, Vulkan SDK `1.4.363.0`). ### Verification - Built `clear_color_test`, `d3d12_b4g4r4a4_target_test`, and `d3d12_clear_formats_test`. - `clear_color_test`: **525 checks passed**. - `d3d12_clear_formats_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_b4g4r4a4_target_test` (`LEONIDA_VK_VALIDATION=1`): **passed** on **RTX 5080** (RGBA8 fallback exercised, 0 validation errors); **skipped (77)** on **AMD Radeon** (native `A4R4G4B4` attachment). ### Notes (non-blocking) - Channel widths for 5:5:5:1 and 4:4:4:4 (logical RGBA order per `VkClearColorValue`), NaN/Inf clamping, and directed-rounding quantization for the RGBA8 fallback (`vulkan_replay.h:1550-1567`, `1637-1653`, `4862-4894`) all look right. - **Minor follow-up note (`vulkan_replay.h:1637-1653`):** `DXGI_FORMAT_B5G6R5_UNORM` (`VK_FORMAT_R5G6B5_UNORM_PACK16`) is also an exposed 16-bit packed UNORM RTV (`d3d12_vulkan_device.cpp:2335-2338`) and still falls through to driver rounding; fine as a follow-up if covering all 16-bit packed UNORM RTVs. Approve. AI-assisted review + local MSVC/dual-GPU verification.
timbot103 commented 2026-11-28 14:36:52 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Static code audit against e7d11f0da + ec740bcc3. The packed clear conversion and the shared color payload for full and rectangular clears look correct.

Both regions now expect green 0x00, so a fallback that always writes zero to green passes (runtime/test/d3d12_b4g4r4a4_target_test.cpp:205). Could the outside clear use green 10.0f / 15.0f and expect 0xAA there? That preserves a nonzero green readback alongside the new negative clamp, tie, and NaN checks.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6098419695 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#pullrequestreview-6098419695). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-28T14:36:52Z. **Review:** COMMENTED --- Static code audit against `e7d11f0da` + `ec740bcc3`. The packed clear conversion and the shared color payload for full and rectangular clears look correct. Both regions now expect green `0x00`, so a fallback that always writes zero to green passes (`runtime/test/d3d12_b4g4r4a4_target_test.cpp:205`). Could the outside clear use green `10.0f / 15.0f` and expect `0xAA` there? That preserves a nonzero green readback alongside the new negative clamp, tie, and NaN checks. AI-assisted.
lixonik commented 2026-11-28 15:44:28 +00:00 (Migrated from github.com)

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


@timbot103 Good catch. 8f45eda7d uses 10.0f / 15.0f green outside the rect and checks for 0xAA. The inside still checks negative green clamping to zero, the red tie, blue clamping and NaN alpha. d3d12_b4g4r4a4_target, d3d12_clear_formats and clear_color all passed on Windows 11 with MSVC and RTX 5070 (610.88).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241698667 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7241698667). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-28T15:44:28Z. --- @timbot103 Good catch. `8f45eda7d` uses `10.0f / 15.0f` green outside the rect and checks for `0xAA`. The inside still checks negative green clamping to zero, the red tie, blue clamping and NaN alpha. `d3d12_b4g4r4a4_target`, `d3d12_clear_formats` and `clear_color` all passed on Windows 11 with MSVC and RTX 5070 (610.88). AI-assisted.
Maticcm commented 2026-11-28 20:55:49 +00:00 (Migrated from github.com)

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


Independent RTX 3080 verification at exact 8f45eda7dbbf091a63ff8732e18a8b191a82e1b8 and parent e7d11f0da41ea971af3627be077c998a9481c915. Native Windows 11 build 26340, NVIDIA driver 630.20, 10 GiB, MSVC 19.50.35717 RelWithDebInfo, Vulkan SDK 1.4.363.1 with Khronos validation.

All three focused CTests passed on both revisions (clear_color, d3d12_clear_formats, d3d12_b4g4r4a4_target) without skips. On the exact head, the 4444 render target used the RGBA8 fallback and all 64×32 pixels matched, including the new nonzero green 0xAA outside the clear rectangle. The format suite reported 261 WARP matches, zero differing or failed clears, and five checks for formats the layer does not expose. The fallback fixture reported zero Vulkan validation errors.

Synthetic fixtures. AI-assisted (Codex).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245647954 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7245647954). Originally posted by [Maticcm](https://github.com/Maticcm) on 2026-11-28T20:55:49Z. --- Independent RTX 3080 verification at exact `8f45eda7dbbf091a63ff8732e18a8b191a82e1b8` and parent `e7d11f0da41ea971af3627be077c998a9481c915`. Native Windows 11 build 26340, NVIDIA driver 630.20, 10 GiB, MSVC 19.50.35717 RelWithDebInfo, Vulkan SDK 1.4.363.1 with Khronos validation. All three focused CTests passed on both revisions (`clear_color`, `d3d12_clear_formats`, `d3d12_b4g4r4a4_target`) without skips. On the exact head, the 4444 render target used the RGBA8 fallback and all 64×32 pixels matched, including the new nonzero green `0xAA` outside the clear rectangle. The format suite reported 261 WARP matches, zero differing or failed clears, and five checks for formats the layer does not expose. The fallback fixture reported zero Vulkan validation errors. Synthetic fixtures. AI-assisted (Codex).
zmasi commented 2026-11-29 02:42:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:42:28Z.


Windows 11 + RTX 3090 + WARP Verification (8f45eda7db merged with main c8bf0e7b65) — PASS

  • Environment: Windows 11 (10.0.26200), MSVC 19.44.35207 (/O2 /MD /EHsc /std:c++20 /W4 /permissive- /utf-8), NVIDIA GeForce RTX 3090 (610.88) + Microsoft WARP + VK_LAYER_KHRONOS_validation 1.4.363.1 (LEONIDA_VK_VALIDATION=1).
  • Merge & Hygiene: Clean git merge-tree onto main (c8bf0e7b65) (0 conflicts); python -I scripts/check_no_game_data.py rc=0; 0 new /W4 warnings.
  • Red -> Green:
    • Red 1 (clear_color_test.cpp compiled against main runtime/src/vulkan_replay.h): fails with rc=1 (normalised clear: format 8 rect 0 channel 0: got 0.5, expected 0.516129017).
    • Red 2 (d3d12_b4g4r4a4_target_test.cpp linked against main on NVIDIA GeForce RTX 3090 under FE_DOWNWARD): fails with rc=1 (texel (11, 4) = 77 00 ff 00, want 88 00 ff 00 because std::nearbyint rounded 0.5 * 15 downward to 7 instead of 8).
    • Green (8f45eda7db + main c8bf0e7b65):
      1. clear_color_test.exe: rc=0 (525 full/rectangle integer, normalised and float replay checks passed across FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO, out-of-range, and NaN inputs).
      2. d3d12_b4g4r4a4_target_test.exe on NVIDIA GeForce RTX 3090: rc=0 (OK (RGBA8 image, render-target clears 64x32 matched, SRV T# format 136, 0 validation errors)).
      3. d3d12_clear_formats_test.exe on NVIDIA GeForce RTX 3090 + WARP: rc=0 (clears: 261 matched WARP, 0 differ, 0 failed, 0 VUID- validation errors).

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249596529 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7249596529). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T02:42:28Z. --- ### Windows 11 + RTX 3090 + WARP Verification (`8f45eda7db` merged with `main` `c8bf0e7b65`) — PASS - **Environment**: Windows 11 (`10.0.26200`), MSVC `19.44.35207` (`/O2 /MD /EHsc /std:c++20 /W4 /permissive- /utf-8`), **NVIDIA GeForce RTX 3090** (`610.88`) + Microsoft WARP + `VK_LAYER_KHRONOS_validation` `1.4.363.1` (`LEONIDA_VK_VALIDATION=1`). - **Merge & Hygiene**: Clean `git merge-tree` onto `main` (`c8bf0e7b65`) (`0` conflicts); `python -I scripts/check_no_game_data.py` `rc=0`; `0` new `/W4` warnings. - **Red -> Green**: - **Red 1 (`clear_color_test.cpp` compiled against `main` `runtime/src/vulkan_replay.h`)**: fails with `rc=1` (`normalised clear: format 8 rect 0 channel 0: got 0.5, expected 0.516129017`). - **Red 2 (`d3d12_b4g4r4a4_target_test.cpp` linked against `main` on NVIDIA GeForce RTX 3090 under `FE_DOWNWARD`)**: fails with `rc=1` (`texel (11, 4) = 77 00 ff 00, want 88 00 ff 00` because `std::nearbyint` rounded `0.5 * 15` downward to `7` instead of `8`). - **Green (`8f45eda7db` + `main` `c8bf0e7b65`)**: 1. `clear_color_test.exe`: `rc=0` (**`525 full/rectangle integer, normalised and float replay checks passed`** across `FE_DOWNWARD`, `FE_UPWARD`, `FE_TOWARDZERO`, out-of-range, and `NaN` inputs). 2. `d3d12_b4g4r4a4_target_test.exe` on **NVIDIA GeForce RTX 3090**: `rc=0` (**`OK (RGBA8 image, render-target clears 64x32 matched, SRV T# format 136, 0 validation errors)`**). 3. `d3d12_clear_formats_test.exe` on **NVIDIA GeForce RTX 3090** + WARP: `rc=0` (**`clears: 261 matched WARP, 0 differ, 0 failed`**, `0` `VUID-` validation errors). AI-assisted.
OreoFR commented 2026-11-29 05:47:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T05:47:14Z.


Verified by OreoFR — READY

  • Base: main c8bf0e7b6 + this PR (head 8f45eda7d) merged with --no-ff
  • Red (main + only this PR's tests): all 3 fail. clear_color: line 213, wrong == 0, because the PACK16 rows are not quantized. d3d12_clear_formats: got 0.5, expected 0.516129017 on format 8, and 4 clears differ from WARP. d3d12_b4g4r4a4_target fails as well.
  • Green (merge): all three pass; ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p1 = main + #2546 + #1681 + #2479 + #1790 (no shared files): 495 tests, new failures vs main: none; an xmem working-set check failed once in the package as it does on main, and passed 5/5 when re-run alone (main alone: 494 tests, 5 failures: loader, xs_proxy_mock, xmem_no_write_watch, api_ref_state timeout, xbox_present; xbox_present fails in every package as on main)
  • gta6rt.exe links without the XMA decoder (LEONIDA_CARGO=OFF, LEONIDA_XMA2_DECODER_LIB empty), main + this PR alone; imports unchanged vs main (25 DLLs, 655 functions, no WS2_32)
  • Diff read: no issue (checked the channel maxima, and that rounding is to even whatever the FP rounding mode).
  • Other runs: Consistent with zmasi's and Maticcm's PASS runs.
  • Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44

AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7251459359 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7251459359). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T05:47:14Z. --- **Verified by OreoFR** — READY - Base: main c8bf0e7b6 + this PR (head 8f45eda7d) merged with --no-ff - Red (main + only this PR's tests): all 3 fail. `clear_color`: line 213, `wrong == 0`, because the PACK16 rows are not quantized. `d3d12_clear_formats`: `got 0.5, expected 0.516129017` on format 8, and 4 clears differ from WARP. `d3d12_b4g4r4a4_target` fails as well. - Green (merge): all three pass; ctest (Ninja RelWithDebInfo, all targets, gta6rt launchers excluded) in package p1 = main + #2546 + #1681 + #2479 + #1790 (no shared files): 495 tests, new failures vs main: none; an xmem working-set check failed once in the package as it does on main, and passed 5/5 when re-run alone (main alone: 494 tests, 5 failures: loader, xs_proxy_mock, xmem_no_write_watch, api_ref_state timeout, xbox_present; xbox_present fails in every package as on main) - gta6rt.exe links without the XMA decoder (`LEONIDA_CARGO=OFF`, `LEONIDA_XMA2_DECODER_LIB` empty), main + this PR alone; imports unchanged vs main (25 DLLs, 655 functions, no WS2_32) - Diff read: no issue (checked the channel maxima, and that rounding is to even whatever the FP rounding mode). - Other runs: Consistent with zmasi's and Maticcm's PASS runs. - Machine: Windows 11, Intel Core Ultra 7 155H, RTX 4070 Laptop 8 GB, NVIDIA 621.40, Python 3.12.10, MSVC 19.44 AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
lixonik commented 2026-11-29 15:57:12 +00:00 (Migrated from github.com)

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


Merged main (1d3da5ebc7) as aa1752225f to resolve the runtime/src/vulkan_replay.h conflict with #778 (d3d-sample-positions), keeping active_samples in detail::initialize(...) alongside detail::quantize_unorm(channel, 15.0).

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

  • ctest --output-on-failure -R "^(clear_color|d3d12_clear_formats|d3d12_b4g4r4a4_target)$": 3/3 passed.
  • python -I scripts/check_no_game_data.py: passed.

AI-assisted (Antigravity, Gemini).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258498662 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7258498662). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-29T15:57:12Z. --- Merged `main` (`1d3da5ebc7`) as `aa1752225f` to resolve the `runtime/src/vulkan_replay.h` conflict with #778 (`d3d-sample-positions`), keeping `active_samples` in `detail::initialize(...)` alongside `detail::quantize_unorm(channel, 15.0)`. Local verification (Windows 11, MSVC 19.44, RTX 5070, `LEONIDA_VK_VALIDATION=1`, `VK_VALIDATE_SYNC=1`): - `ctest --output-on-failure -R "^(clear_color|d3d12_clear_formats|d3d12_b4g4r4a4_target)$"`: 3/3 passed. - `python -I scripts/check_no_game_data.py`: passed. AI-assisted (Antigravity, Gemini).
OreoFR commented 2026-11-29 21:06:28 +00:00 (Migrated from github.com)

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


Verified by OreoFR (re-run at the new head after the main merge)

  • Heads: PR head aa1752225 merged with --no-ff onto main 0e8737f2a; the PR's files are unchanged on main up to 7bbc1d223, and the PR still merges cleanly there
  • GPU: NVIDIA GeForce RTX 4070 Laptop 8 GB, driver 621.40, Windows 11, MSVC 19.44, Ninja RelWithDebInfo, LEONIDA_CARGO=OFF
  • Red (merge with runtime/src/vulkan_replay.h restored to main, so only the PR's tests are new): 3 of 3 fail
    • clear_color: format 8 rect 0 channel 0: got 0.5, expected 0.516129017
    • d3d12_b4g4r4a4_target: line 213, wrong == 0 (texels 77 where 88 is expected)
    • d3d12_clear_formats: 599 clears match WARP, 4 differ
  • Green (merge): 3 of 3 pass (clear_color, d3d12_clear_formats, d3d12_b4g4r4a4_target)
  • Full ctest (all targets, gta6rt launcher tests excluded): 512 tests, 3 failures
    • loader and xbox_present fail on main too
    • d3d12_queue_wait_timeout (a 10 s timeout control) timed out twice while other builds were loading the machine, then passed 9 of 9 re-runs alone. The PR does not touch the queue wait path, so I count it as load-sensitive, not a regression.
  • Link: gta6rt.exe imports the same 25 DLLs as the main-side build, with no WS2_32. The only difference is one fewer CRT function: nearbyintf is no longer imported.
  • Rebase on #2566 needed: no (the merged tree merges cleanly with #2566's head cfd12b24f)
  • Verdict: READY. This agrees with my run at the previous head 8f45eda7d and with the author's run at this head.

Ready to merge per the maintainers' plan.

This verification was AI-assisted (Claude Code, oreofr-agent).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7262609454 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7262609454). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-29T21:06:28Z. --- **Verified by OreoFR** (re-run at the new head after the main merge) - Heads: PR head `aa1752225` merged with `--no-ff` onto main `0e8737f2a`; the PR's files are unchanged on main up to `7bbc1d223`, and the PR still merges cleanly there - GPU: NVIDIA GeForce RTX 4070 Laptop 8 GB, driver 621.40, Windows 11, MSVC 19.44, Ninja RelWithDebInfo, `LEONIDA_CARGO=OFF` - Red (merge with `runtime/src/vulkan_replay.h` restored to main, so only the PR's tests are new): 3 of 3 fail - `clear_color`: `format 8 rect 0 channel 0: got 0.5, expected 0.516129017` - `d3d12_b4g4r4a4_target`: line 213, `wrong == 0` (texels `77` where `88` is expected) - `d3d12_clear_formats`: 599 clears match WARP, 4 differ - Green (merge): 3 of 3 pass (`clear_color`, `d3d12_clear_formats`, `d3d12_b4g4r4a4_target`) - Full ctest (all targets, gta6rt launcher tests excluded): 512 tests, 3 failures - `loader` and `xbox_present` fail on main too - `d3d12_queue_wait_timeout` (a 10 s timeout control) timed out twice while other builds were loading the machine, then passed 9 of 9 re-runs alone. The PR does not touch the queue wait path, so I count it as load-sensitive, not a regression. - Link: `gta6rt.exe` imports the same 25 DLLs as the main-side build, with no WS2_32. The only difference is one fewer CRT function: `nearbyintf` is no longer imported. - Rebase on #2566 needed: no (the merged tree merges cleanly with #2566's head `cfd12b24f`) - Verdict: READY. This agrees with my run at the previous head `8f45eda7d` and with the author's run at this head. Ready to merge per the maintainers' plan. This verification was AI-assisted (Claude Code, oreofr-agent).
ammonium231 commented 2026-11-30 13:43:43 +00:00 (Migrated from github.com)

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


RTX 3090 / 621.40, validation on, aa1752225 merged onto main f9f3ec4c6: clear_color_test 577 pass (main 567); d3d12_clear_formats_test 603 match WARP, 0 differ (main 598); b4g4r4a4 OK. No validation errors.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7280266401 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7280266401). Originally posted by [ammonium231](https://github.com/ammonium231) on 2026-11-30T13:43:43Z. --- RTX 3090 / 621.40, validation on, aa1752225 merged onto main f9f3ec4c6: clear_color_test 577 pass (main 567); d3d12_clear_formats_test 603 match WARP, 0 differ (main 598); b4g4r4a4 OK. No validation errors.
aslan2142 commented 2026-12-01 16:45:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:45:10Z.


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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7318159606 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2479#issuecomment-7318159606). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:45:10Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

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!2479
No description provided.