Allow floating-point tolerance for ray distance in check_dxr_update #112

Manually merged
github merged 3 commits from gh-pr/112/head into gh-pr/112/base 2026-11-26 21:27:42 +00:00
Owner

@⁠Holastor on GitHub · 2026-11-21 16:21 UTC · original
Holastor:fix/dxr-update-tolerance → main · +7 −1 · 1 files · 3 commits · merged 2026-11-21 17:35 UTC

Change

In `tests/dxr_check.cpp`, `check_dxr_update` performed a strict bitwise 32-bit equality check on the ray distance
(`field == 3`) using `bvh_fixture::equal`.

On physical AMD RDNA 2 hardware (such as Radeon RX 6600M on driver 32.0.21045.11001), DXR ray intersection
distance calculations can vary by 1 ULP (`0.99999994f` / `0x3f7fffff` instead of `1.0f` / `0x3f800000`).

This change applies a floating-point tolerance check (`< 1e-4f`) for the ray distance field when `id != 0`,
consistent with the tolerance already used in `check_dxr_query` (line 155).

Verification

- **Environment**: Windows 11 x64, MSVC 19.51, CMake `dev` preset
- **Adapter**: AMD Radeon RX 6600M (driver `32.0.21045.11001`, vendor `1002`, device `73ff`)
- **D3D12 Debug Layer**: Enabled

Command

```powershell
ctest --preset dev -R 'dxr_update_hardware' -V

Result

• Before: Failed (record=0 field=3 expected=3f800000 actual=3f7fffff).
• After: Passed in 0.14s:
dxr_tier=11 shader_model_capped_at_6_5=0x65
dxr_update rays=7 changed_hits=4 in_place_matches_rebuild=1
debug_errors=0 debug_warnings=0
1/1 Test #19: dxr_update_hardware .............. Passed 0.14 sec

Software adapter test dxr_update_warp continues to pass unchanged.

Evidence and follow-up

• Matches the existing floating-point comparison pattern established in check_dxr_query:
const bool distance_matches = hit ? std::abs(distance - 1.f) < 1e-5f : value[3] == 0;
• Resolves the false-positive failure on AMD Radeon RX 6000-series mobile and desktop adapters under recent
Adrenalin drivers.

**@⁠Holastor** on GitHub · 2026-11-21 16:21 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/112) `Holastor:fix/dxr-update-tolerance` → `main` · +7 −1 · 1 files · 3 commits · merged 2026-11-21 17:35 UTC ## Change In `tests/dxr_check.cpp`, `check_dxr_update` performed a strict bitwise 32-bit equality check on the ray distance (`field == 3`) using `bvh_fixture::equal`. On physical AMD RDNA 2 hardware (such as Radeon RX 6600M on driver 32.0.21045.11001), DXR ray intersection distance calculations can vary by 1 ULP (`0.99999994f` / `0x3f7fffff` instead of `1.0f` / `0x3f800000`). This change applies a floating-point tolerance check (`< 1e-4f`) for the ray distance field when `id != 0`, consistent with the tolerance already used in `check_dxr_query` (line 155). ## Verification - **Environment**: Windows 11 x64, MSVC 19.51, CMake `dev` preset - **Adapter**: AMD Radeon RX 6600M (driver `32.0.21045.11001`, vendor `1002`, device `73ff`) - **D3D12 Debug Layer**: Enabled ### Command ```powershell ctest --preset dev -R 'dxr_update_hardware' -V ### Result • Before: Failed (record=0 field=3 expected=3f800000 actual=3f7fffff). • After: Passed in 0.14s: dxr_tier=11 shader_model_capped_at_6_5=0x65 dxr_update rays=7 changed_hits=4 in_place_matches_rebuild=1 debug_errors=0 debug_warnings=0 1/1 Test #19: dxr_update_hardware .............. Passed 0.14 sec Software adapter test dxr_update_warp continues to pass unchanged. ## Evidence and follow-up • Matches the existing floating-point comparison pattern established in check_dxr_query: const bool distance_matches = hit ? std::abs(distance - 1.f) < 1e-5f : value[3] == 0; • Resolves the false-positive failure on AMD Radeon RX 6000-series mobile and desktop adapters under recent Adrenalin drivers.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:27:41 +00:00
github manually merged commit a72720ee6c into gh-pr/112/base 2026-11-26 21:27:42 +00:00
Author
Owner

@⁠danielradosa on GitHub · 2026-11-21 16:27 UTC · original

Same result on a second RDNA 2 device: the integrated AMD Radeon(TM) Graphics of a Ryzen 5 7600 (vendor 1002, device 164e), driver 32.0.21045.29003, Windows 11 build 26300.9974, debug layer enabled.

  • main at 88fd8c5, with the adapter selection from #116 to reach the integrated GPU: dxr_update_hardware fails with record=0 field=3 expected=3f800000 actual=3f7fffff.
  • With this PR applied as well: it passes (dxr_update rays=7 changed_hits=4 in_place_matches_rebuild=1, 0 debug errors and 0 warnings). dxr_update_warp, and dxr_update_hardware on the RTX 4060 in the same PC, also pass.
**@⁠danielradosa** on GitHub · 2026-11-21 16:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/112#issuecomment-7065665174) Same result on a second RDNA 2 device: the integrated AMD Radeon(TM) Graphics of a Ryzen 5 7600 (vendor `1002`, device `164e`), driver `32.0.21045.29003`, Windows 11 build 26300.9974, debug layer enabled. - `main` at 88fd8c5, with the adapter selection from #116 to reach the integrated GPU: `dxr_update_hardware` fails with `record=0 field=3 expected=3f800000 actual=3f7fffff`. - With this PR applied as well: it passes (`dxr_update rays=7 changed_hits=4 in_place_matches_rebuild=1`, 0 debug errors and 0 warnings). `dxr_update_warp`, and `dxr_update_hardware` on the RTX 4060 in the same PC, also pass.
Author
Owner

@⁠denn0x on GitHub · 2026-11-21 17:33 UTC · original

RDNA 4 confirmation: the RX 9070 XT shows the same 1-ULP distance, and this branch fixes it.

  • AMD Radeon RX 9070 XT (RDNA 4; vendor 1002, device 7550), driver 32.0.32015.7029, D3D12 debug layer enabled
  • Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0 with its DXC
  • PR head commit as fetched, not merged with current main
ctest --preset dev --no-tests=error -R '^(dxr_update|ffx_provider_loop)_(hardware|warp)$' -V
Build dxr_update_hardware dxr_update_warp
main at 245b207 fails: record=0 field=3 expected=3f800000 actual=3f7fffff passes
PR head d92f364 passes: rays=7 changed_hits=4 in_place_matches_rebuild=1 passes

Every run reports debug_errors=0 debug_warnings=0. Together with the RX 6600M and the Ryzen 5 7600 iGPU, the 1-ULP result now shows up on RDNA 2 and RDNA 4. The RDNA 2 drivers were 32.0.21045.x; this one is 32.0.32015.7029.

AI-assisted (Claude Code); run locally on the configuration above.

**@⁠denn0x** on GitHub · 2026-11-21 17:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/112#issuecomment-7066576344) RDNA 4 confirmation: the RX 9070 XT shows the same 1-ULP distance, and this branch fixes it. - AMD Radeon RX 9070 XT (RDNA 4; vendor 1002, device 7550), driver 32.0.32015.7029, D3D12 debug layer enabled - Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0 with its DXC - PR head commit as fetched, not merged with current `main` ```powershell ctest --preset dev --no-tests=error -R '^(dxr_update|ffx_provider_loop)_(hardware|warp)$' -V ``` | Build | `dxr_update_hardware` | `dxr_update_warp` | |---|---|---| | `main` at 245b207 | fails: `record=0 field=3 expected=3f800000 actual=3f7fffff` | passes | | PR head d92f364 | passes: `rays=7 changed_hits=4 in_place_matches_rebuild=1` | passes | Every run reports `debug_errors=0 debug_warnings=0`. Together with the RX 6600M and the Ryzen 5 7600 iGPU, the 1-ULP result now shows up on RDNA 2 and RDNA 4. The RDNA 2 drivers were 32.0.21045.x; this one is 32.0.32015.7029. _AI-assisted (Claude Code); run locally on the configuration above._
This discussion has been locked. Commenting is limited to contributors.
No description provided.