runtime: Depth24 CPU conversions independent of the thread's rounding mode (RT-D24-CPU-ROUNDEVEN) #1858

Merged
leonida/mandy
thiefyzheng merged 1 commit from fix/d24-cpu-roundeven into main 2026-11-29 08:09:53 +00:00

Pull request successfully merged and closed

thiefyzheng commented 2026-11-25 13:19:01 +00:00

RT-D24-CPU-ROUNDEVEN

Claimed on #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163485212). Fixes @cheltyi's finding (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163281819): runtime/src/depth24.h's CPU-side Depth24 conversion followed the calling thread's rounding mode (float multiply + std::nearbyint), while depth24_convert.comp is roundEven of a correctly rounded product — so a thread with directed rounding (FE_DOWNWARD/FE_TOWARDZERO) quantized 0x1p-23f to 1 instead of 2 (~1 integer ULP off, beyond the documented 0.6 ULP tolerance), letting CPU clears (vulkan_replay.h depth24_clear_value) disagree with GPU uploads/copies. depth24_to_float had the same environment dependence.

What

  • depth24_detail::round_even: floor/fmod-based ties-to-even, exact in every rounding mode — no fesetround, no fenv dependence, holds under -ffast-math.
  • depth24_quantize: exact double(value) * 16777215.0 (24×24 bits fit a double), round to 24 significant bits via ldexp+round_even, then round to integer — the shader's two roundings.
  • depth24_to_float: the shader's integer formula ldexp(float(m+1), e-47), every step exact.
  • No existing helper fits (vulkan_replay.h's round_half_even rounds once and lives in a header that includes this one's users).
  • New runtime/test/depth24_cpu_test.cpp (ctest depth24_cpu, no GPU, no Vulkan loader; the clear_color_test pattern): runs both directions under FE_TONEAREST / FE_DOWNWARD / FE_UPWARD / FE_TOWARDZERO against a nearest-mode reference, with fixed cases (0x1p-23f -> 2, 0.5f -> 8388608 tie-to-even).

What was run

  • g++ -std=c++20 -O2 (also -frounding-math): 1,858,324 checks passed across all four rounding modes (all 2^24 codes round-trip in nearest and downward; every third float pattern in [0,1] quantized nearest-vs-towardzero); plus -ffast-math: 0 mismatches. Before the fix the old header fails immediately under FE_DOWNWARD (depth24_quantize(0x1p-23) = 1, expected 2).
  • MSVC on Windows (VS 2022 BuildTools, RelWithDebInfo, VS generator): depth24_cpu_test built and ctest -R depth24_cpu Passed (0.67 s).
  • Not run: the device-side tests (depth24_convert_test, d3d12_depth24_draw) — no Vulkan device here; the CPU/GPU cross-check on hardware would be the remaining confirmation, though both sides now implement the same documented formula.

Attribution

AI-assisted (Claude Sonnet 5.5 worker implementation, contributor verification incl. the winvm MSVC build, orchestration).

## RT-D24-CPU-ROUNDEVEN Claimed on #1608 (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163485212). Fixes @cheltyi's finding (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163281819): `runtime/src/depth24.h`'s CPU-side Depth24 conversion followed the calling thread's rounding mode (float multiply + `std::nearbyint`), while `depth24_convert.comp` is `roundEven` of a correctly rounded product — so a thread with directed rounding (FE_DOWNWARD/FE_TOWARDZERO) quantized `0x1p-23f` to 1 instead of 2 (~1 integer ULP off, beyond the documented 0.6 ULP tolerance), letting CPU clears (`vulkan_replay.h` `depth24_clear_value`) disagree with GPU uploads/copies. `depth24_to_float` had the same environment dependence. ### What - `depth24_detail::round_even`: floor/fmod-based ties-to-even, exact in every rounding mode — no `fesetround`, no fenv dependence, holds under `-ffast-math`. - `depth24_quantize`: exact `double(value) * 16777215.0` (24×24 bits fit a double), round to 24 significant bits via `ldexp`+`round_even`, then round to integer — the shader's two roundings. - `depth24_to_float`: the shader's integer formula `ldexp(float(m+1), e-47)`, every step exact. - No existing helper fits (`vulkan_replay.h`'s `round_half_even` rounds once and lives in a header that includes this one's users). - New `runtime/test/depth24_cpu_test.cpp` (ctest `depth24_cpu`, no GPU, no Vulkan loader; the `clear_color_test` pattern): runs both directions under FE_TONEAREST / FE_DOWNWARD / FE_UPWARD / FE_TOWARDZERO against a nearest-mode reference, with fixed cases (`0x1p-23f -> 2`, `0.5f -> 8388608` tie-to-even). ### What was run - g++ `-std=c++20 -O2` (also `-frounding-math`): **1,858,324 checks passed across all four rounding modes** (all 2^24 codes round-trip in nearest and downward; every third float pattern in [0,1] quantized nearest-vs-towardzero); plus `-ffast-math`: 0 mismatches. Before the fix the old header fails immediately under FE_DOWNWARD (`depth24_quantize(0x1p-23) = 1, expected 2`). - **MSVC on Windows (VS 2022 BuildTools, RelWithDebInfo, VS generator)**: `depth24_cpu_test` built and `ctest -R depth24_cpu` **Passed** (0.67 s). - **Not run**: the device-side tests (`depth24_convert_test`, `d3d12_depth24_draw`) — no Vulkan device here; the CPU/GPU cross-check on hardware would be the remaining confirmation, though both sides now implement the same documented formula. ### Attribution AI-assisted (Claude Sonnet 5.5 worker implementation, contributor verification incl. the winvm MSVC build, orchestration).
potatoe0100 commented 2026-11-25 13:57:49 +00:00

Tested on Windows 11 (26300), NVIDIA GeForce RTX 4060, driver 621.14, VS 2022 RelWithDebInfo + Ninja, merged onto main 384abe5b: depth24_cpu passes, and so do the device-side depth24_convert, d3d12_depth24_draw, d3d12_d24_support and clear_color. That covers the CPU/GPU cross-check you couldn't run, on NVIDIA at least.

I also ran an exhaustive check with MSVC /fp:strict. Every float in (0, 1) went through depth24_quantize under all four rounding modes and was compared with main's float multiply + nearbyint in round-to-nearest: 4,261,412,860 checks, 0 mismatches (main's header mismatches under the directed modes). All 2^24 codes through depth24_to_float give the nearest float to d / 16777215 and round-trip in every mode; main gets 16,777,214 of those wrong under the directed modes.

Reading the change: x + 0.5 in round_even is exact at both call sites (at most 24 integer and 24 fraction bits), and float(m + 1) is at most 2^24, so neither path depends on the rounding mode. Looks correct to me.

AI-assisted (Claude).

Tested on Windows 11 (26300), NVIDIA GeForce RTX 4060, driver 621.14, VS 2022 RelWithDebInfo + Ninja, merged onto `main` 384abe5b: `depth24_cpu` passes, and so do the device-side `depth24_convert`, `d3d12_depth24_draw`, `d3d12_d24_support` and `clear_color`. That covers the CPU/GPU cross-check you couldn't run, on NVIDIA at least. I also ran an exhaustive check with MSVC `/fp:strict`. Every float in (0, 1) went through `depth24_quantize` under all four rounding modes and was compared with main's float multiply + `nearbyint` in round-to-nearest: 4,261,412,860 checks, 0 mismatches (main's header mismatches under the directed modes). All 2^24 codes through `depth24_to_float` give the nearest float to d / 16777215 and round-trip in every mode; main gets 16,777,214 of those wrong under the directed modes. Reading the change: `x + 0.5` in `round_even` is exact at both call sites (at most 24 integer and 24 fraction bits), and `float(m + 1)` is at most 2^24, so neither path depends on the rounding mode. Looks correct to me. AI-assisted (Claude).
thiefyzheng commented 2026-11-25 14:01:52 +00:00

@potatoe0100 — thank you; this closes every verification gap the PR body listed. Recording for whoever merges: on Windows/RTX 4060 (NVIDIA 621.14), the CPU test plus all device-side Depth24 tests pass (depth24_convert, d3d12_depth24_draw, d3d12_d24_support, clear_color), an exhaustive MSVC /fp:strict sweep over every float in (0,1) x all four rounding modes — 4,261,412,860 checks, 0 mismatches against the round-to-nearest reference (main's header mismatches under directed modes), all 2^24 depth24_to_float codes round-trip in every mode (main wrong on 16,777,214 of them), and a reading confirmation that neither path depends on the rounding environment (x + 0.5 exact at both call sites, float(m+1) at most 2^24).

The PR is now CPU-verified (g++ and MSVC), GPU-cross-checked on NVIDIA, and exhaustively swept — nothing left except merge. AI-assisted (orchestrator).

@potatoe0100 — thank you; this closes every verification gap the PR body listed. Recording for whoever merges: on Windows/RTX 4060 (NVIDIA 621.14), the CPU test plus all device-side Depth24 tests pass (`depth24_convert`, `d3d12_depth24_draw`, `d3d12_d24_support`, `clear_color`), an exhaustive MSVC /fp:strict sweep over every float in (0,1) x all four rounding modes — **4,261,412,860 checks, 0 mismatches** against the round-to-nearest reference (main's header mismatches under directed modes), all 2^24 `depth24_to_float` codes round-trip in every mode (main wrong on 16,777,214 of them), and a reading confirmation that neither path depends on the rounding environment (`x + 0.5` exact at both call sites, `float(m+1)` at most 2^24). The PR is now CPU-verified (g++ and MSVC), GPU-cross-checked on NVIDIA, and exhaustively swept — nothing left except merge. AI-assisted (orchestrator).
Timon360SB commented 2026-11-25 14:03:45 +00:00

Independent verification — Turing and Blackwell

Tested the exact merge base and PR head on two NVIDIA architectures under native Windows.

  • Base: 98c2f7777276f83eb90b491a51721ef90a43ea73
  • Head: 06c3b4a6ac65d044faa7c99a10f46094cbfa9fc5

Environment

Configuration RTX 5070 RTX 2060 SUPER
Architecture Blackwell Turing
NVIDIA driver 621.14 621.14
Windows 11 build 26200 28000
Vulkan device API 1.4.357 1.4.357
Vulkan SDK 1.4.363.0 1.4.363.0
Khronos validation layer 1.4.363 1.4.363

MSVC 19.44.35230, Ninja Multi-Config, RelWithDebInfo.

Validated runs requested core validation, GPU-assisted validation and synchronization validation.

Results

Three initial repetitions per configuration, followed by two additional sets of validated runs.

Duplicate checkpoint results were excluded using execution timestamps and SHA-256 hashes of the original CTest logs.

Test Base Head
depth24_convert, validation off 6/6 6/6
depth24_convert, validation on 0/18 0/18
d3d12_depth24_draw 24/24 24/24
d3d12_d24_support 24/24 24/24
Total 54/72 54/72

Across 144 unique CTest executions: 108 passed, 36 failed.

Results were identical on both GPU architectures.

Depth24 conversion results

Every execution of depth24_convert, including those that subsequently failed under validation, reported:

  • All 16,777,216 depth words converted to the nearest float of d / 16777215.
  • All 16,777,216 depth words survived the float round trip.
  • Both infinities and all NaN payloads quantized correctly.
  • All 16,777,216 tested float patterns, including specials, ties and neighboring values, quantized like the reference.

Existing validation failure

depth24_convert failed under validation on both revisions and both GPUs.

The following diagnostics reproduced in every validated execution:

  • VUID-vkCmdCopyBufferToImage-pRegions-07931
  • line 559: value == 0
  • VUID-vkDestroyDevice-device-05137 — an undestroyed VkQueryPool.

The symptoms match those discussed in #1475. No isolated validation-layer configuration experiment was performed to establish the cause independently.

Depth24 rendering

d3d12_depth24_draw passed in every execution, including LESS/EQUAL comparisons, stored-depth checks and fragment-depth output.

Six internal depth-bias clamp cases per execution were skipped because depthBiasClamp was unavailable for native D24.

d3d12_d24_support also passed in every execution.

Conclusion

No new regressions were observed in the three selected CTest scenarios on either Turing or Blackwell.

The existing validation-only failure remains unchanged.

The new depth24_cpu test and explicit changes to the CPU floating-point rounding mode were not exercised in this run. Therefore, these results provide hardware regression coverage, not independent verification of rounding-mode invariance.

Synthetic tests only. No game files used.

AI-assisted: yes, test automation and result analysis.

## Independent verification — Turing and Blackwell Tested the exact merge base and PR head on two NVIDIA architectures under native Windows. - **Base:** `98c2f7777276f83eb90b491a51721ef90a43ea73` - **Head:** `06c3b4a6ac65d044faa7c99a10f46094cbfa9fc5` ### Environment | Configuration | RTX 5070 | RTX 2060 SUPER | |---|---|---| | Architecture | Blackwell | Turing | | NVIDIA driver | 621.14 | 621.14 | | Windows 11 build | 26200 | 28000 | | Vulkan device API | 1.4.357 | 1.4.357 | | Vulkan SDK | 1.4.363.0 | 1.4.363.0 | | Khronos validation layer | 1.4.363 | 1.4.363 | MSVC 19.44.35230, Ninja Multi-Config, RelWithDebInfo. Validated runs requested core validation, GPU-assisted validation and synchronization validation. ### Results Three initial repetitions per configuration, followed by two additional sets of validated runs. Duplicate checkpoint results were excluded using execution timestamps and SHA-256 hashes of the original CTest logs. | Test | Base | Head | |---|---:|---:| | `depth24_convert`, validation off | 6/6 | 6/6 | | `depth24_convert`, validation on | 0/18 | 0/18 | | `d3d12_depth24_draw` | 24/24 | 24/24 | | `d3d12_d24_support` | 24/24 | 24/24 | | **Total** | **54/72** | **54/72** | Across 144 unique CTest executions: **108 passed, 36 failed**. Results were identical on both GPU architectures. ### Depth24 conversion results Every execution of `depth24_convert`, including those that subsequently failed under validation, reported: - All 16,777,216 depth words converted to the nearest float of `d / 16777215`. - All 16,777,216 depth words survived the float round trip. - Both infinities and all NaN payloads quantized correctly. - All 16,777,216 tested float patterns, including specials, ties and neighboring values, quantized like the reference. ### Existing validation failure `depth24_convert` failed under validation on both revisions and both GPUs. The following diagnostics reproduced in every validated execution: - `VUID-vkCmdCopyBufferToImage-pRegions-07931` - `line 559: value == 0` - `VUID-vkDestroyDevice-device-05137` — an undestroyed `VkQueryPool`. The symptoms match those discussed in #1475. No isolated validation-layer configuration experiment was performed to establish the cause independently. ### Depth24 rendering `d3d12_depth24_draw` passed in every execution, including LESS/EQUAL comparisons, stored-depth checks and fragment-depth output. Six internal depth-bias clamp cases per execution were skipped because `depthBiasClamp` was unavailable for native D24. `d3d12_d24_support` also passed in every execution. ### Conclusion No new regressions were observed in the three selected CTest scenarios on either Turing or Blackwell. The existing validation-only failure remains unchanged. The new `depth24_cpu` test and explicit changes to the CPU floating-point rounding mode were not exercised in this run. Therefore, these results provide hardware regression coverage, not independent verification of rounding-mode invariance. Synthetic tests only. No game files used. AI-assisted: yes, test automation and result analysis.
thiefyzheng commented 2026-11-25 14:12:44 +00:00

@Timon360SB — thank you for the two-architecture sweep. Recording for the merge decision: base and head are behaviorally identical on RTX 5070 (Blackwell) and RTX 2060 SUPER (Turing) across 144 deduplicated validated ctest runs — d3d12_depth24_draw and d3d12_d24_support green in every execution, and every depth24_convert run (validation off) converting all 16,777,216 words to the nearest float with full round-trip survival, identical on both archs. No new regressions; the depth24_convert failures under GPU-assisted validation are the known, already-documented class from #1475 (VUID-07931/05137), unchanged between base and head.

As you note, this is hardware regression coverage; the rounding-mode invariance itself stands on the CPU receipts (g++ ASan/UBSan corpus + MSVC build & ctest + your earlier /fp:strict sweep is potatoe0100's — the exhaustive cross-arch picture is now: CPU invariance proven, device parity and non-regression proven on NVIDIA across three architectures). Together with @potatoe0100's run, only merge remains. AI-assisted (orchestrator).

@Timon360SB — thank you for the two-architecture sweep. Recording for the merge decision: base and head are behaviorally identical on RTX 5070 (Blackwell) and RTX 2060 SUPER (Turing) across 144 deduplicated validated ctest runs — `d3d12_depth24_draw` and `d3d12_d24_support` green in every execution, and every `depth24_convert` run (validation off) converting all 16,777,216 words to the nearest float with full round-trip survival, identical on both archs. No new regressions; the `depth24_convert` failures under GPU-assisted validation are the known, already-documented class from #1475 (VUID-07931/05137), unchanged between base and head. As you note, this is hardware regression coverage; the rounding-mode invariance itself stands on the CPU receipts (g++ ASan/UBSan corpus + MSVC build & ctest + your earlier /fp:strict sweep is potatoe0100's — the exhaustive cross-arch picture is now: CPU invariance proven, device parity and non-regression proven on NVIDIA across three architectures). Together with @potatoe0100's run, only merge remains. AI-assisted (orchestrator).
OreoFR commented 2026-11-28 22:11:54 +00:00

Verified by OreoFR

  • Base: main a8465211f + PR head 06c3b4a6a (merged with --no-ff, no conflict; tested in a package with other PRs that share no file with it)
  • Test: ctest -R ^depth24_cpu$ (red: this test with src/depth24.h from main)
  • Red on main: fails: under one of the swept rounding modes depth24_quantize(0x1p-23) gives 1 instead of 2
  • Green with the PR: passes; full ctest on the package: 486 tests, only the known main failure xbox_present plus one flaky test that passed 3/3 on rerun
  • Verdict: READY
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11
  • Note: shares runtime/CMakeLists.txt with the open #2566; a rebase may be needed if #2566 lands first.

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

**Verified by OreoFR** - Base: main `a8465211f` + PR head `06c3b4a6a` (merged with --no-ff, no conflict; tested in a package with other PRs that share no file with it) - Test: `ctest -R ^depth24_cpu$` (red: this test with src/depth24.h from main) - Red on main: fails: under one of the swept rounding modes `depth24_quantize(0x1p-23)` gives 1 instead of 2 - Green with the PR: passes; full ctest on the package: 486 tests, only the known main failure `xbox_present` plus one flaky test that passed 3/3 on rerun - Verdict: READY - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 - Note: shares `runtime/CMakeLists.txt` with the open #2566; a rebase may be needed if #2566 lands first. AI-assisted (Claude Code, Claude Opus 5.5).
OreoFR commented 2026-11-29 02:09:37 +00:00

Verified by OreoFR: link check

  • main 59e65849b + this PR (head 06c3b4a6a, the head verified earlier) merged with --no-ff, built without the XMA decoder (LEONIDA_CARGO=OFF, no LEONIDA_XMA2_DECODER_LIB: configure reports the XMA2 and Opus decoders not built), RelWithDebInfo, Ninja, MSVC 19.44.35230 (VS 2022 BuildTools), LEONIDA_REQUIRE_VULKAN=ON
  • gta6rt.exe links; imports unchanged vs main built the same way (dumpbin /imports: 25 DLLs, 655 functions, no WS2_32)
  • gta6rt was not launched.

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

**Verified by OreoFR**: link check - main `59e65849b` + this PR (head `06c3b4a6a`, the head verified earlier) merged with --no-ff, built without the XMA decoder (`LEONIDA_CARGO=OFF`, no `LEONIDA_XMA2_DECODER_LIB`: configure reports the XMA2 and Opus decoders not built), RelWithDebInfo, Ninja, MSVC 19.44.35230 (VS 2022 BuildTools), `LEONIDA_REQUIRE_VULKAN=ON` - `gta6rt.exe` links; imports unchanged vs main built the same way (`dumpbin /imports`: 25 DLLs, 655 functions, no WS2_32) - gta6rt was not launched. AI-assisted (Claude Code, Claude Opus 5.5), run for OreoFR.
zmasi commented 2026-11-29 02:14:02 +00:00

Independently verified head 06c3b4a6ac65d044faa7c99a10f46094cbfa9fc5 merged cleanly onto origin/main (59e65849b0927ee8c435baf1c74aecd08104fd60) on Windows 11 (10.0.26200), MSVC 19.44.35207 (RelWithDebInfo), NVIDIA GeForce RTX 3090 (driver 595.79), with VK_LAYER_KHRONOS_validation 1.4.363.1 (LEONIDA_VK_VALIDATION=1). No game files used.

Red -> Green Verification

  • Red (main's runtime/src/depth24.h with PR's depth24_cpu_test.cpp):
    • ctest -C RelWithDebInfo -R "^depth24_cpu$": FAILED (rc=8) under directed rounding (FE_DOWNWARD / FE_TOWARDZERO: depth24_quantize(0x1p-23) = 1, expected 2).
  • Green (#1858 merged with origin/main 59e65849b0 on RTX 3090):
    • Validated CTest Suite (LEONIDA_VK_VALIDATION=1, 0 Khronos validation errors):
      • depth24_cpu: Passed (FE_TONEAREST, FE_DOWNWARD, FE_UPWARD, FE_TOWARDZERO all match round-to-nearest-even reference and round-trip cleanly).
      • clear_color: Passed.
      • d3d12_depth24_draw: Passed (0 Khronos validation errors).
      • d3d12_d24_support: Passed (0 Khronos validation errors).
    • Exhaustive Device-Side Conversion (depth24_convert, LEONIDA_VK_VALIDATION=0 due to pre-existing #1475 test copy-region VUID):
      • depth24_convert: Passed (8.56 s on RTX 3090, all 16,777,216 24-bit depth words converted and round-tripped).
    • scripts/check_no_game_data.py & tests/test_ctest_registration.py: Passed.

Code Audit Notes

  • Forming exact = double(value) * 16777215.0 in IEEE-754 binary64 (24 + 24 = 48 <= 53 significand bits) has zero intermediate rounding in any FP rounding mode, and depth24_detail::round_even uses only std::floor and std::fmod on inputs where x + 0.5 has at most 24 integer and 24 fraction bits (48 <= 53), making both the 24-bit significand rounding and integer rounding exact and independent of fenv.
  • depth24_to_float(d) (std::ldexp(static_cast<float>(m + 1u), e - 47)) uses at most 2^24 in m + 1u, which is exact in float regardless of the calling thread's rounding mode and matches depth24_convert.comp.

AI-assisted: yes

Independently verified head `06c3b4a6ac65d044faa7c99a10f46094cbfa9fc5` merged cleanly onto `origin/main` (`59e65849b0927ee8c435baf1c74aecd08104fd60`) on Windows 11 (`10.0.26200`), MSVC `19.44.35207` (`RelWithDebInfo`), **NVIDIA GeForce RTX 3090** (driver `595.79`), with `VK_LAYER_KHRONOS_validation` `1.4.363.1` (`LEONIDA_VK_VALIDATION=1`). No game files used. ### Red -> Green Verification - **Red (`main`'s `runtime/src/depth24.h` with PR's `depth24_cpu_test.cpp`)**: - `ctest -C RelWithDebInfo -R "^depth24_cpu$"`: **FAILED (`rc=8`)** under directed rounding (`FE_DOWNWARD` / `FE_TOWARDZERO`: `depth24_quantize(0x1p-23) = 1, expected 2`). - **Green (`#1858` merged with `origin/main` `59e65849b0` on RTX 3090)**: - **Validated CTest Suite (`LEONIDA_VK_VALIDATION=1`, `0` Khronos validation errors)**: - `depth24_cpu`: **Passed** (`FE_TONEAREST`, `FE_DOWNWARD`, `FE_UPWARD`, `FE_TOWARDZERO` all match round-to-nearest-even reference and round-trip cleanly). - `clear_color`: **Passed**. - `d3d12_depth24_draw`: **Passed** (`0` Khronos validation errors). - `d3d12_d24_support`: **Passed** (`0` Khronos validation errors). - **Exhaustive Device-Side Conversion (`depth24_convert`, `LEONIDA_VK_VALIDATION=0` due to pre-existing `#1475` test copy-region VUID)**: - `depth24_convert`: **Passed** (`8.56 s` on RTX 3090, all `16,777,216` 24-bit depth words converted and round-tripped). - `scripts/check_no_game_data.py` & `tests/test_ctest_registration.py`: **Passed**. ### Code Audit Notes - Forming `exact = double(value) * 16777215.0` in IEEE-754 binary64 (`24 + 24 = 48 <= 53` significand bits) has zero intermediate rounding in any FP rounding mode, and `depth24_detail::round_even` uses only `std::floor` and `std::fmod` on inputs where `x + 0.5` has at most 24 integer and 24 fraction bits (`48 <= 53`), making both the 24-bit significand rounding and integer rounding exact and independent of `fenv`. - `depth24_to_float(d)` (`std::ldexp(static_cast<float>(m + 1u), e - 47)`) uses at most `2^24` in `m + 1u`, which is exact in `float` regardless of the calling thread's rounding mode and matches `depth24_convert.comp`. AI-assisted: yes
MoonEyes commented 2026-11-29 08:09:57 +00:00

Merged after OreoFR's red/green check (check: green with this PR merged onto main, red without it; gta6rt.exe still links with unchanged imports when the PR touches the runtime) and a re-check here: no conflict with main 01d7f7f70, same head as checked, not frozen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on main or Vulkan).

AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes.

Merged after **OreoFR**'s red/green check ([check](https://github.com/ProjectLeonida/mandy/pull/1858#issuecomment-7249247579): green with this PR merged onto `main`, red without it; `gta6rt.exe` still links with unchanged imports when the PR touches the runtime) and a re-check here: no conflict with `main` 01d7f7f70, same head as checked, not frozen, and the only ctest failures in the Windows/macOS CI jobs are tests this diff does not touch (known on `main` or Vulkan). _AI-assisted (Claude Code, Claude Opus 5.5), merged for MoonEyes._
Sign in to join this conversation.
No description provided.