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

Merged
Holastor merged 3 commits from upstream-pr/112 into main 2026-11-21 17:35:00 +00:00
Holastor commented 2026-11-21 16:21:22 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Holastor on 2026-11-21T16:21:22Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6531353152 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/112). Originally posted by [Holastor](https://github.com/Holastor) on 2026-11-21T16:21:22Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:41:22 +00:00
danielradosa commented 2026-11-24 06:47:37 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by danielradosa on 2026-11-21T16:27:49Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7065665174 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/112#issuecomment-7065665174). Originally posted by [danielradosa](https://github.com/danielradosa) on 2026-11-21T16:27:49Z. --- 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.
denn0x commented 2026-11-24 06:47:43 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-21T17:33:51Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7066576344 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/112#issuecomment-7066576344). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-21T17:33:51Z. --- 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._
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
R0Y00/Xbox2Windows!111
No description provided.