Compare DXR opacity and non-opaque candidate handling with a CPU reference #216

Manually merged
github merged 5 commits from gh-pr/216/head into gh-pr/216/base 2026-11-26 21:35:01 +00:00
Owner

@⁠Vonsek on GitHub · 2026-11-21 18:30 UTC · original
Vonsek:dxr-opacity-candidates → main · +437 −14 · 9 files · 5 commits · merged 2026-11-22 07:36 UTC

Change

Adds dxr_opacity_warp and dxr_opacity_hardware, a differential check of triangle opacity, opacity culling and first-hit search between a CPU reference and inline DXR queries. Every existing DXR fixture builds one geometry with D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE and traces with RayQuery<RAY_FLAG_FORCE_OPAQUE>, so no non-opaque candidate has reached a shader so far, and RAY_FLAG_CULL_OPAQUE/CULL_NON_OPAQUE cannot be combined with that template flag.

A BLAS holds four single-triangle geometries stacked along z at depths 1 to 4; geometries 1 and 3 are opaque. Three instances use no flags, D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_OPAQUE and D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_NON_OPAQUE. Each receives 42 rays: both directions along z, seven ray flag sets (NONE, FORCE_OPAQUE, FORCE_NON_OPAQUE, CULL_OPAQUE, CULL_NON_OPAQUE, ACCEPT_FIRST_HIT_AND_END_SEARCH alone and with FORCE_NON_OPAQUE) and three accept masks. The new tests/ray_candidates.hlsl declares RayQuery<RAY_FLAG_NONE>, commits a non-opaque candidate when its geometry index is in the ray's accept mask (a fixture convention in bits 16-19 of the flags word), and reports per ray: committed status, instance ID, geometry and primitive index, distance, the set of presented candidate geometries, whether any candidate was presented after a commit, and whether any candidate was not a non-opaque triangle inside the ray extents and in front of the current committed hit.

dxr_fixture::trace gains an optional per-triangle geometry flags list. When given, each triangle becomes its own geometry and ray_candidates.hlsl traces the rays. Existing callers pass nothing and keep one opaque geometry and ray_query.hlsl.

Verification

  • Windows: ctest --preset dev --no-tests=error -R '^dxr_opacity_' -V at f069a47 on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100 (DXC 1.9.2602.17), D3D12 debug layer unavailable: 2/2 passed.
    • NVIDIA GeForce RTX 5080, driver 32.0.16.1692, dxr_tier=12: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0
    • WARP (Microsoft Basic Render Driver 10.0.26100.9818), dxr_tier=11: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0
    • Earlier revisions on the same machine: the first (strict on both backends) gave WARP mismatches=11, first line ray=15 flags=0x4 expected hit=1 instance=1 geometry=1 distance=2 committable=0xa candidates required=0x0 allowed=0x5 actual word0=0x503 instance=1 geometry=1 primitive=0 distance=2. The second (relaxing only automatic opaque commits) gave WARP mismatches=10 after_shader_commit=10 after_opaque_commit=2 warp_after_commit=1, with after_shader_commit on rays 19, 20, 61, 62, 100, 101, 103 and 104 and both kinds on rays 16 and 17. In every one of these rays the final committed hit matched the reference; all 11 are the first-hit case described under Evidence. The RTX 5080 gave mismatches=0 in all four runs. An independent run by @⁠denn0x at f069a47 on an RX 9070 XT (RDNA 4, driver 32.0.32015.7029) with the D3D12 debug layer enabled reported mismatches=0 committed_t_plus_tmin=43 and debug_errors=0 debug_warnings=0 on hardware, and the same WARP result as above.
  • Regression of the shared trace helper: ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V passed 8/8 on both backends (dxr_facing rays=84 hits=64 front_hits=32 culled=20 mismatches=0). The full ctest --preset dev --no-tests=error passed 123/123, with bvh_wave64_hardware, bvh_wave64_warp and wave_shuffle_warp skipped.
  • CPU reference: the header-only reference agrees with a hand-derived table on all 126 rays (94 hits, 42 committed by the shader, 32 misses, 36 first-hit rays). Swapping ray and instance flag precedence in the reference makes the table check fail at ray 48.
  • check_dxr_opacity was also linked against a stand-in trace that follows the specification's traversal with a random visit order per ray; it passed with 200 different orders. Fault controls all failed the check: ignoring instance flags (34-40 mismatches), letting instance flags override ray flags (18), not ending a first-hit search at a shader commit (12-16), dropping presented candidates (64-65), and treating every triangle as opaque as the existing RAY_FLAG_FORCE_OPAQUE query does (73).
  • With a Linux stand-in reproducing the WARP behaviour, the hardware path fails with mismatches=22 and the WARP path passes with warp_after_commit=22, while every other injected fault (ignored instance flags, swapped precedence, dropped candidates, all-opaque, unaccepted commits) still fails on the WARP path.

Evidence and follow-up

The fixture is synthetic and original to this repository (MIT). Expected values come from tests/dxr_opacity_reference.h, which intersects every triangle in double precision and applies the specification's opacity order: ray FORCE_OPAQUE/FORCE_NON_OPAQUE override instance FORCE_OPAQUE/FORCE_NON_OPAQUE, which override the geometry flag; CULL_OPAQUE/CULL_NON_OPAQUE then remove primitives by the resulting opacity. Ignoring instance flags alone would change the closest hit on 26 of the 126 rays. Ray flags · Instance flags · TraceRayInline control flow

Without the first-hit flag the result must equal the closest committable hit exactly. With it, the query may end on any committable hit, but no candidate may be presented after a commit. Each non-opaque triangle in front of the closest hit, and each committed one, must have been presented, and nothing else may be. Hit distances of 1 to 4 may differ by 1e-5 relative. Candidate counts and visit order are implementation-defined and are not compared. Rays cross triangle interiors well inside the distance interval, so edge and endpoint rules stay out of scope. The test skips below DXR tier 1.1 or Shader Model 6.5.

Committed distance on RDNA 4. The specification defines both CommittedRayT() and CandidateTriangleRayT() as the parametric distance from the ray origin. On an RX 9070 XT, every hit committed by the shader with CommitNonOpaqueTriangleHit() reported CommittedRayT() equal to the candidate's distance plus the ray's TMin; automatic opaque commits were correct. The shader records CandidateTriangleRayT at each shader commit, and a shader-committed hit with the right instance, geometry, primitive and candidate distance whose committed distance is exactly that distance plus TMin (0.25 for every ray) is counted as committed_t_plus_tmin instead of failing. Any other distance error still fails. A candidate at exactly the committed distance is allowed (t <= limit), because an implementation may present the committed triangle or an equal-distance one again; candidates behind the committed hit or outside the ray extents are still flagged.

Known WARP deviation. WARP 10.0.26100.9818 does not end a first-hit search at a committed hit, automatic or shader (specification: Ray flags, RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH; TraceRayInline control flow, note 6). It keeps presenting nearer non-opaque candidates, but its final committed hit stays valid. The RTX 5080 follows the rule. On WARP only, the test counts such a ray as warp_after_commit and does not fail on it, provided the final hit is committable and every other check on that ray passes. Hardware stays fully strict.

Reproduction details are in docs/experiments.md. Follow-up: add dxr-opacity to the standalone GPU package runner, and extend the fixture to procedural primitives with CommitProceduralPrimitiveHit.

**@⁠Vonsek** on GitHub · 2026-11-21 18:30 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216) `Vonsek:dxr-opacity-candidates` → `main` · +437 −14 · 9 files · 5 commits · merged 2026-11-22 07:36 UTC ## Change Adds `dxr_opacity_warp` and `dxr_opacity_hardware`, a differential check of triangle opacity, opacity culling and first-hit search between a CPU reference and inline DXR queries. Every existing DXR fixture builds one geometry with `D3D12_RAYTRACING_GEOMETRY_FLAG_OPAQUE` and traces with `RayQuery<RAY_FLAG_FORCE_OPAQUE>`, so no non-opaque candidate has reached a shader so far, and `RAY_FLAG_CULL_OPAQUE`/`CULL_NON_OPAQUE` cannot be combined with that template flag. A BLAS holds four single-triangle geometries stacked along z at depths 1 to 4; geometries 1 and 3 are opaque. Three instances use no flags, `D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_OPAQUE` and `D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_NON_OPAQUE`. Each receives 42 rays: both directions along z, seven ray flag sets (`NONE`, `FORCE_OPAQUE`, `FORCE_NON_OPAQUE`, `CULL_OPAQUE`, `CULL_NON_OPAQUE`, `ACCEPT_FIRST_HIT_AND_END_SEARCH` alone and with `FORCE_NON_OPAQUE`) and three accept masks. The new `tests/ray_candidates.hlsl` declares `RayQuery<RAY_FLAG_NONE>`, commits a non-opaque candidate when its geometry index is in the ray's accept mask (a fixture convention in bits 16-19 of the flags word), and reports per ray: committed status, instance ID, geometry and primitive index, distance, the set of presented candidate geometries, whether any candidate was presented after a commit, and whether any candidate was not a non-opaque triangle inside the ray extents and in front of the current committed hit. `dxr_fixture::trace` gains an optional per-triangle geometry flags list. When given, each triangle becomes its own geometry and `ray_candidates.hlsl` traces the rays. Existing callers pass nothing and keep one opaque geometry and `ray_query.hlsl`. ## Verification - Windows: `ctest --preset dev --no-tests=error -R '^dxr_opacity_' -V` at f069a47 on Windows 11 build 26200.9974, VS Build Tools 2022 17.14 (MSVC 14.44.35207), Windows SDK 10.0.26100 (DXC 1.9.2602.17), D3D12 debug layer unavailable: 2/2 passed. - NVIDIA GeForce RTX 5080, driver 32.0.16.1692, `dxr_tier=12`: `dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0` - WARP (Microsoft Basic Render Driver 10.0.26100.9818), `dxr_tier=11`: `dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0` - Earlier revisions on the same machine: the first (strict on both backends) gave WARP `mismatches=11`, first line `ray=15 flags=0x4 expected hit=1 instance=1 geometry=1 distance=2 committable=0xa candidates required=0x0 allowed=0x5 actual word0=0x503 instance=1 geometry=1 primitive=0 distance=2`. The second (relaxing only automatic opaque commits) gave WARP `mismatches=10 after_shader_commit=10 after_opaque_commit=2 warp_after_commit=1`, with `after_shader_commit` on rays 19, 20, 61, 62, 100, 101, 103 and 104 and both kinds on rays 16 and 17. In every one of these rays the final committed hit matched the reference; all 11 are the first-hit case described under Evidence. The RTX 5080 gave `mismatches=0` in all four runs. An independent run by @⁠denn0x at f069a47 on an RX 9070 XT (RDNA 4, driver 32.0.32015.7029) with the D3D12 debug layer enabled reported `mismatches=0 committed_t_plus_tmin=43` and `debug_errors=0 debug_warnings=0` on hardware, and the same WARP result as above. - Regression of the shared trace helper: `ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V` passed 8/8 on both backends (`dxr_facing rays=84 hits=64 front_hits=32 culled=20 mismatches=0`). The full `ctest --preset dev --no-tests=error` passed 123/123, with `bvh_wave64_hardware`, `bvh_wave64_warp` and `wave_shuffle_warp` skipped. - CPU reference: the header-only reference agrees with a hand-derived table on all 126 rays (94 hits, 42 committed by the shader, 32 misses, 36 first-hit rays). Swapping ray and instance flag precedence in the reference makes the table check fail at ray 48. - `check_dxr_opacity` was also linked against a stand-in trace that follows the specification's traversal with a random visit order per ray; it passed with 200 different orders. Fault controls all failed the check: ignoring instance flags (34-40 mismatches), letting instance flags override ray flags (18), not ending a first-hit search at a shader commit (12-16), dropping presented candidates (64-65), and treating every triangle as opaque as the existing `RAY_FLAG_FORCE_OPAQUE` query does (73). - With a Linux stand-in reproducing the WARP behaviour, the hardware path fails with `mismatches=22` and the WARP path passes with `warp_after_commit=22`, while every other injected fault (ignored instance flags, swapped precedence, dropped candidates, all-opaque, unaccepted commits) still fails on the WARP path. ## Evidence and follow-up The fixture is synthetic and original to this repository (MIT). Expected values come from `tests/dxr_opacity_reference.h`, which intersects every triangle in double precision and applies the specification's opacity order: ray `FORCE_OPAQUE`/`FORCE_NON_OPAQUE` override instance `FORCE_OPAQUE`/`FORCE_NON_OPAQUE`, which override the geometry flag; `CULL_OPAQUE`/`CULL_NON_OPAQUE` then remove primitives by the resulting opacity. Ignoring instance flags alone would change the closest hit on 26 of the 126 rays. [Ray flags](https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#ray-flags) · [Instance flags](https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#d3d12_raytracing_instance_flags) · [TraceRayInline control flow](https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html#tracerayinline-control-flow) Without the first-hit flag the result must equal the closest committable hit exactly. With it, the query may end on any committable hit, but no candidate may be presented after a commit. Each non-opaque triangle in front of the closest hit, and each committed one, must have been presented, and nothing else may be. Hit distances of 1 to 4 may differ by 1e-5 relative. Candidate counts and visit order are implementation-defined and are not compared. Rays cross triangle interiors well inside the distance interval, so edge and endpoint rules stay out of scope. The test skips below DXR tier 1.1 or Shader Model 6.5. Committed distance on RDNA 4. The specification defines both `CommittedRayT()` and `CandidateTriangleRayT()` as the parametric distance from the ray origin. On an RX 9070 XT, every hit committed by the shader with `CommitNonOpaqueTriangleHit()` reported `CommittedRayT()` equal to the candidate's distance plus the ray's TMin; automatic opaque commits were correct. The shader records `CandidateTriangleRayT` at each shader commit, and a shader-committed hit with the right instance, geometry, primitive and candidate distance whose committed distance is exactly that distance plus TMin (0.25 for every ray) is counted as `committed_t_plus_tmin` instead of failing. Any other distance error still fails. A candidate at exactly the committed distance is allowed (`t <= limit`), because an implementation may present the committed triangle or an equal-distance one again; candidates behind the committed hit or outside the ray extents are still flagged. Known WARP deviation. WARP 10.0.26100.9818 does not end a first-hit search at a committed hit, automatic or shader (specification: Ray flags, `RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH`; TraceRayInline control flow, note 6). It keeps presenting nearer non-opaque candidates, but its final committed hit stays valid. The RTX 5080 follows the rule. On WARP only, the test counts such a ray as `warp_after_commit` and does not fail on it, provided the final hit is committable and every other check on that ray passes. Hardware stays fully strict. Reproduction details are in [docs/experiments.md](docs/experiments.md#opacity-and-candidate-handling-in-inline-queries). Follow-up: add `dxr-opacity` to the standalone GPU package runner, and extend the fixture to procedural primitives with `CommitProceduralPrimitiveHit`.
Add dxr_opacity_warp and dxr_opacity_hardware. A BLAS of four stacked
single-triangle geometries, two of them opaque, is instanced with no
flags, FORCE_OPAQUE and FORCE_NON_OPAQUE. 126 inline queries cover the
FORCE_OPAQUE, FORCE_NON_OPAQUE, CULL_OPAQUE, CULL_NON_OPAQUE and
ACCEPT_FIRST_HIT_AND_END_SEARCH ray flags with a shader that commits
selected non-opaque candidates.

The CPU reference applies ray over instance over geometry opacity and is
checked against a hand-derived table before any GPU work. The GPU result
must match the closest hit exactly, end a first-hit search at its first
commit, and present every required non-opaque candidate and no others.

dxr_fixture::trace can now build one geometry per triangle with given
flags; existing callers keep one opaque geometry and ray_query.hlsl.
WARP 10.0.26100.9818 still presents non-opaque candidates in front of an
opaque hit it committed automatically under
RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH, while its final committed hit
stays valid. The shader now separates candidates after its own commit
from candidates after an automatic opaque commit. On WARP only, the
latter is counted as warp_after_commit when every other check on the ray
passes; hardware stays strict.

The test now prints up to 16 failing rays with their categories and a
count per category.
WARP 10.0.26100.9818 does not end a first-hit search at a committed hit,
automatic or shader: on 11 rays it presented further candidates after a
shader commit, an automatic opaque commit or both, while its final
committed hit stayed valid. On WARP only, such a ray is now counted as
warp_after_commit when the final hit is committable and every other
check passes. Hardware stays strict.
On an AMD RDNA 4 GPU, CommittedRayT() after CommitNonOpaqueTriangleHit()
returned the candidate distance plus TMin. The shader now records
CandidateTriangleRayT at each of its commits and moves the committed
geometry and primitive into word 0. A shader-committed hit with correct
identity and candidate distance whose CommittedRayT equals that distance
plus TMin is counted as committed_t_plus_tmin instead of failing; every
other distance error still fails.

A candidate at exactly the committed distance is no longer treated as
out of range, since an implementation may present the committed triangle
or an equal-distance one again.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 21:35:00 +00:00
github manually merged commit 62801fcf1b into gh-pr/216/base 2026-11-26 21:35:01 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 18:52 UTC · original · edited 2026-11-21 18:58 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T18:58:49.950155Z 9a73480 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 18:52 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#issuecomment-7067572548) · edited 2026-11-21 18:58 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"9a73480357cf6f7df87f7a1cd0df0f38b7ee2f91","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-21T18:58:49.950155Z">2026-11-21T18:58:49.950155Z</relative-time> | `9a73480` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 18:58 UTC · original

P2 Badge Allow repeated candidates at the committed hit distance

For a closest-hit query that accepts a non-opaque triangle, DXR can present the same primitive more than once, including at the current committed distance. For example, presenting geometry 0 twice at distance 1 for ray 1 leaves the final hit and candidate masks valid, but the second visit has t == q.CommittedRayT(), so this strict comparison sets anomaly and makes check_dxr_opacity fail on a valid traversal. Allow equality at the committed upper bound, or explicitly handle repeated candidates; placing different geometries at unique depths does not prevent duplicate visits to the same primitive.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 18:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#discussion_r4654443399) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Allow repeated candidates at the committed hit distance** For a closest-hit query that accepts a non-opaque triangle, DXR can present the same primitive more than once, including at the current committed distance. For example, presenting geometry 0 twice at distance 1 for ray 1 leaves the final hit and candidate masks valid, but the second visit has `t == q.CommittedRayT()`, so this strict comparison sets `anomaly` and makes `check_dxr_opacity` fail on a valid traversal. Allow equality at the committed upper bound, or explicitly handle repeated candidates; placing different geometries at unique depths does not prevent duplicate visits to the same primitive. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠denn0x on GitHub · 2026-11-21 19:06 UTC · original

Independent run at 9a73480 on RDNA 4. dxr_opacity_hardware fails, and every mismatch is a hit the shader committed. In each one, CommittedRayT() is the true distance plus the ray's TMin.

Environment: Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502, D3D12 debug layer enabled on both backends.

ctest --preset dev --no-tests=error -R '^dxr_opacity_' -V
27: adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550
27: driver=32.0.32015.7029
27: dxr_tier=11 shader_model_capped_at_6_5=0x65
27: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=43 committed_hit=43
27: debug_errors=0 debug_warnings=0
48: adapter=Microsoft Basic Render Driver vendor=1414 device=008c
48: driver=10.0.26100.9818
48: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11
48: debug_errors=0 debug_warnings=0

First mismatch:

ray=1 flags=0xf0000 [committed_hit] expected hit=1 instance=1 geometry=0 distance=1 committable=0xf candidates required=0x1 allowed=0x5 actual word0=0x101 instance=1 geometry=0 primitive=0 distance=1.25

Measured on the unmodified head:

  • All 43 mismatches are committed_hit only.
  • In each, the committed geometry is non-opaque for that ray, so the shader committed it.
  • In each, the distance is the true distance + 0.25. All rays use TMin = 0.25.
  • Instance, geometry, primitive and candidate sets all pass.
  • Six of the 43 end on a different geometry from the closest hit. All six are first-hit rays, and the geometry they end on is committable.
  • The regression selection -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' gives 7/8. The only failure is dxr_opacity_hardware; dxr_query, dxr_update and dxr_facing pass on both backends.

Local probes. These are diagnostic edits only, reverted, and not proposed changes:

  • TMin = 0.125 in dxr_opacity_reference.h: still 43 mismatches, each now off by exactly +0.125.
  • TMin = 0: classifying all 126 rays, the hardware matches the reference on every category. All 51 automatic opaque commits are exact in all three runs.
  • Recording CandidateTriangleRayT() at the commit instead of CommittedRayT() (TMin = 0.25): all 43 shader-committed rays then have the exact distance. The candidate distance is correct; only the committed distance read back after CommitNonOpaqueTriangleHit() is offset.
  • Not a DXC-version difference: the same DXIL gives exact distances on WARP. This DXC is 1.8; your report used 1.9.

Hypothesis, not established: this looks like a driver-side difference in how the committed T of a shader-committed triangle is stored or returned (t + TMin), similar to an origin-relative versus TMin-relative mix-up. I did not test whether the driver also uses the offset value to bound later candidates. The fixture's 1.0 spacing between triangles is much larger than 0.25, so it cannot show that.

I'm not suggesting any relaxation of the strict hardware check; how to treat this is your call. I can rerun any revision on this GPU.

AI-assisted (Claude Code).

**@⁠denn0x** on GitHub · 2026-11-21 19:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#issuecomment-7067769054) Independent run at `9a73480` on RDNA 4. `dxr_opacity_hardware` fails, and every mismatch is a hit the shader committed. In each one, `CommittedRayT()` is the true distance plus the ray's `TMin`. **Environment:** Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, DXC 1.8.2502, D3D12 debug layer enabled on both backends. ```powershell ctest --preset dev --no-tests=error -R '^dxr_opacity_' -V ``` ```text 27: adapter=AMD Radeon RX 9070 XT vendor=1002 device=7550 27: driver=32.0.32015.7029 27: dxr_tier=11 shader_model_capped_at_6_5=0x65 27: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=43 committed_hit=43 27: debug_errors=0 debug_warnings=0 48: adapter=Microsoft Basic Render Driver vendor=1414 device=008c 48: driver=10.0.26100.9818 48: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 48: debug_errors=0 debug_warnings=0 ``` First mismatch: ```text ray=1 flags=0xf0000 [committed_hit] expected hit=1 instance=1 geometry=0 distance=1 committable=0xf candidates required=0x1 allowed=0x5 actual word0=0x101 instance=1 geometry=0 primitive=0 distance=1.25 ``` **Measured on the unmodified head:** - All 43 mismatches are `committed_hit` only. - In each, the committed geometry is non-opaque for that ray, so the shader committed it. - In each, the distance is the true distance + 0.25. All rays use `TMin` = 0.25. - Instance, geometry, primitive and candidate sets all pass. - Six of the 43 end on a different geometry from the closest hit. All six are first-hit rays, and the geometry they end on is committable. - The regression selection `-R '^dxr_(query|update|facing|opacity)_(warp|hardware)$'` gives 7/8. The only failure is `dxr_opacity_hardware`; `dxr_query`, `dxr_update` and `dxr_facing` pass on both backends. **Local probes.** These are diagnostic edits only, reverted, and not proposed changes: - **`TMin` = 0.125 in `dxr_opacity_reference.h`:** still 43 mismatches, each now off by exactly +0.125. - **`TMin` = 0:** classifying all 126 rays, the hardware matches the reference on every category. All 51 automatic opaque commits are exact in all three runs. - **Recording `CandidateTriangleRayT()` at the commit instead of `CommittedRayT()`** (`TMin` = 0.25): all 43 shader-committed rays then have the exact distance. The candidate distance is correct; only the committed distance read back after `CommitNonOpaqueTriangleHit()` is offset. - **Not a DXC-version difference:** the same DXIL gives exact distances on WARP. This DXC is 1.8; your report used 1.9. **Hypothesis, not established:** this looks like a driver-side difference in how the committed T of a shader-committed triangle is stored or returned (t + TMin), similar to an origin-relative versus TMin-relative mix-up. I did not test whether the driver also uses the offset value to bound later candidates. The fixture's 1.0 spacing between triangles is much larger than 0.25, so it cannot show that. I'm not suggesting any relaxation of the strict hardware check; how to treat this is your call. I can rerun any revision on this GPU. _AI-assisted (Claude Code)._
Author
Owner

@⁠denn0x on GitHub · 2026-11-21 19:43 UTC · original

Rerun at f069a47 on the same machine: RX 9070 XT (driver 32.0.32015.7029) and WARP 10.0.26100.9818, Windows 11 build 26200, DXC 1.8.2502, debug layer enabled on both.

ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V
32: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 committed_t_plus_tmin=43
32: debug_errors=0 debug_warnings=0
53: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0
53: debug_errors=0 debug_warnings=0
100% tests passed, 0 tests failed out of 8
  • Hardware: committed_t_plus_tmin=43. That is the same 43 shader-committed rays as before, now reported rather than failed, and in each one the recorded candidate distance is exact.
  • WARP: reports 0, with warp_after_commit=11 as before.
  • Other DXR fixtures: dxr_query, dxr_update and dxr_facing pass on both backends (dxr_facing rays=96 hits=72 front_hits=36 culled=24 mismatches=0).

On the t <= limit change: at 9a73480, with the strict t < limit, this GPU reported no candidate_out_of_range on any ray. So RDNA 4 does not need the equality allowance in this fixture.

AI-assisted (Claude Code).

**@⁠denn0x** on GitHub · 2026-11-21 19:43 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#issuecomment-7068226692) Rerun at `f069a47` on the same machine: RX 9070 XT (driver 32.0.32015.7029) and WARP 10.0.26100.9818, Windows 11 build 26200, DXC 1.8.2502, debug layer enabled on both. ```powershell ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V ``` ```text 32: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 committed_t_plus_tmin=43 32: debug_errors=0 debug_warnings=0 53: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0 53: debug_errors=0 debug_warnings=0 100% tests passed, 0 tests failed out of 8 ``` - **Hardware:** `committed_t_plus_tmin=43`. That is the same 43 shader-committed rays as before, now reported rather than failed, and in each one the recorded candidate distance is exact. - **WARP:** reports 0, with `warp_after_commit=11` as before. - **Other DXR fixtures:** `dxr_query`, `dxr_update` and `dxr_facing` pass on both backends (`dxr_facing rays=96 hits=72 front_hits=36 culled=24 mismatches=0`). On the `t <= limit` change: at `9a73480`, with the strict `t < limit`, this GPU reported no `candidate_out_of_range` on any ray. So RDNA 4 does not need the equality allowance in this fixture. _AI-assisted (Claude Code)._
Author
Owner

@⁠Vonsek on GitHub · 2026-11-21 19:49 UTC · original

Agreed. The range check now allows a candidate at exactly the committed distance (t <= limit), because an implementation may present the committed triangle or an equal-distance one again. Candidates behind the committed hit or outside the ray extents are still flagged.

**@⁠Vonsek** on GitHub · 2026-11-21 19:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#discussion_r4654662632) Agreed. The range check now allows a candidate at exactly the committed distance (`t <= limit`), because an implementation may present the committed triangle or an equal-distance one again. Candidates behind the committed hit or outside the ray extents are still flagged.
Author
Owner

@⁠Vonsek on GitHub · 2026-11-21 19:49 UTC · original

@⁠denn0x Thanks for the RDNA 4 runs. The shader now records CandidateTriangleRayT at each CommitNonOpaqueTriangleHit(). A shader-committed hit with correct identity and candidate distance whose CommittedRayT() equals that distance plus TMin is reported as committed_t_plus_tmin instead of failing. Any other distance error still fails, since the spec defines both as the parametric distance from the ray origin. Your rerun at f069a47 (mismatches=0 committed_t_plus_tmin=43, debug_errors=0) is now in the description, along with your note that the strict t < limit was already enough on RDNA 4.

Here at f069a47, Windows 11 26200.9974: RTX 5080 (driver 32.0.16.1692) mismatches=0 committed_t_plus_tmin=0, WARP mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0; the DXR regression set passed 8/8 and the full suite 123/123.

**@⁠Vonsek** on GitHub · 2026-11-21 19:49 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#issuecomment-7068306320) @⁠denn0x Thanks for the RDNA 4 runs. The shader now records `CandidateTriangleRayT` at each `CommitNonOpaqueTriangleHit()`. A shader-committed hit with correct identity and candidate distance whose `CommittedRayT()` equals that distance plus TMin is reported as `committed_t_plus_tmin` instead of failing. Any other distance error still fails, since the spec defines both as the parametric distance from the ray origin. Your rerun at f069a47 (`mismatches=0 committed_t_plus_tmin=43`, `debug_errors=0`) is now in the description, along with your note that the strict `t < limit` was already enough on RDNA 4. Here at f069a47, Windows 11 26200.9974: RTX 5080 (driver 32.0.16.1692) `mismatches=0 committed_t_plus_tmin=0`, WARP `mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0`; the DXR regression set passed 8/8 and the full suite 123/123.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-21 20:01 UTC · original

Please use the same committed-distance check on every adapter. Compute the expected distance from the ray origin for the legal geometry the query actually committed, using the existing floating-point tolerance. If a ray reports the expected distance plus TMin, increment both committed_t_plus_tmin and the committed mismatch count, and fail that device test. Keep the existing first-hit selection rules, equal-distance candidate allowance, and separate WARP warp_after_commit accounting.

Please include a negative control that injects +TMin and shows the test fails. Record the 43 observed cases on the RX 9070 XT (driver 32.0.32015.7029) with the tested SHA. @⁠denn0x, could you rerun the hardware test on the revised head and post the counts? A documented hardware failure is a valid experimental result. Once the oracle and its controls are verified and required Windows CI passes, merge can proceed independently of a driver fix.

**@⁠R0Y00** on GitHub · 2026-11-21 20:01 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#issuecomment-7068453039) Please use the same committed-distance check on every adapter. Compute the expected distance from the ray origin for the legal geometry the query actually committed, using the existing floating-point tolerance. If a ray reports the expected distance plus `TMin`, increment both `committed_t_plus_tmin` and the committed mismatch count, and fail that device test. Keep the existing first-hit selection rules, equal-distance candidate allowance, and separate WARP `warp_after_commit` accounting. Please include a negative control that injects `+TMin` and shows the test fails. Record the 43 observed cases on the RX 9070 XT (driver 32.0.32015.7029) with the tested SHA. @⁠denn0x, could you rerun the hardware test on the revised head and post the counts? A documented hardware failure is a valid experimental result. Once the oracle and its controls are verified and required Windows CI passes, merge can proceed independently of a driver fix.
Author
Owner

@⁠denn0x on GitHub · 2026-11-21 20:09 UTC · original

@⁠R0Y00 Will do. When Vonsek pushes the revised head, I will rerun ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V on the RX 9070 XT (driver 32.0.32015.7029) and WARP, and post the counts with the tested SHA. The latest result is still the one at f069a47 above.

AI-assisted (Claude Code).

**@⁠denn0x** on GitHub · 2026-11-21 20:09 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#issuecomment-7068547725) @⁠R0Y00 Will do. When Vonsek pushes the revised head, I will rerun `ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V` on the RX 9070 XT (driver 32.0.32015.7029) and WARP, and post the counts with the tested SHA. The latest result is still the one at `f069a47` above. _AI-assisted (Claude Code)._
Author
Owner

@⁠roansystemlabs on GitHub · 2026-11-21 23:22 UTC · original

An NVIDIA Ampere data point for dxr_opacity, to sit next to the RTX 5080 (Blackwell) and RX 9070 XT (RDNA 4) results.

Environment: Windows 11 build 26200, NVIDIA GeForce RTX 3070 (10de:2484, driver 32.0.16.2101), WARP 10.0.26100.9818, MSVC 19.44.35230 (VS Build Tools 2022), Windows SDK 10.0.26100.0 DXC, Python 3.12. D3D12 debug layer not installed on this PC (debug_layer=unavailable).
Tested head: f069a47d217d4ad0bcb39b8e838f241b77c09160, i.e. the head before the revision requested in the latest review (strict committed-distance check on every adapter and the +TMin negative control).

cmake --preset dev
cmake --build --preset dev
ctest --preset dev --no-tests=error
ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V   # 3 runs

Full suite: 123/123 passed, 3 capability skips (bvh_wave64_hardware, bvh_wave64_warp, wave_shuffle_warp, the same as on main on this PC).

DXR set: 8/8 passed in each of 3 runs, identical counts every time:

32: adapter=NVIDIA GeForce RTX 3070 vendor=10de device=2484
32: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 committed_t_plus_tmin=0
53: adapter=Microsoft Basic Render Driver vendor=1414 device=008c
53: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0

So on Ampere CommittedRayT() for shader-committed non-opaque hits is the distance from the ray origin (committed_t_plus_tmin=0), as on the RTX 5080; the +TMin offset is so far only seen on RDNA 4. I'll confirm the stricter check on this GPU once the revised head is up.

AI-assisted: run and prepared with the support of Roan System.

**@⁠roansystemlabs** on GitHub · 2026-11-21 23:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#issuecomment-7070828630) An NVIDIA Ampere data point for `dxr_opacity`, to sit next to the RTX 5080 (Blackwell) and RX 9070 XT (RDNA 4) results. **Environment:** Windows 11 build 26200, NVIDIA GeForce RTX 3070 (`10de:2484`, driver 32.0.16.2101), WARP 10.0.26100.9818, MSVC 19.44.35230 (VS Build Tools 2022), Windows SDK 10.0.26100.0 DXC, Python 3.12. D3D12 debug layer not installed on this PC (`debug_layer=unavailable`). **Tested head:** `f069a47d217d4ad0bcb39b8e838f241b77c09160`, i.e. the head before the revision requested in the latest review (strict committed-distance check on every adapter and the `+TMin` negative control). ```powershell cmake --preset dev cmake --build --preset dev ctest --preset dev --no-tests=error ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V # 3 runs ``` **Full suite:** 123/123 passed, 3 capability skips (`bvh_wave64_hardware`, `bvh_wave64_warp`, `wave_shuffle_warp`, the same as on `main` on this PC). **DXR set:** 8/8 passed in each of 3 runs, identical counts every time: ```text 32: adapter=NVIDIA GeForce RTX 3070 vendor=10de device=2484 32: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 committed_t_plus_tmin=0 53: adapter=Microsoft Basic Render Driver vendor=1414 device=008c 53: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0 ``` So on Ampere `CommittedRayT()` for shader-committed non-opaque hits is the distance from the ray origin (`committed_t_plus_tmin=0`), as on the RTX 5080; the `+TMin` offset is so far only seen on RDNA 4. I'll confirm the stricter check on this GPU once the revised head is up. _AI-assisted: run and prepared with the support of Roan System._
Author
Owner

@⁠denn0x on GitHub · 2026-11-22 07:42 UTC · original

Rerun of the merged revision at 7f13b7f (main), as promised above. The environment is the same machine: RX 9070 XT (driver 32.0.32015.7029) and WARP 10.0.26100.9818, Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, with the D3D12 debug layer enabled on both backends.

cmake --preset dev
cmake --build --preset dev
ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V
45: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=43 committed_hit=43 committed_t_plus_tmin=43
45: debug_errors=0 debug_warnings=0
70: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0
70: debug_errors=0 debug_warnings=0
88% tests passed, 1 tests failed out of 8
  • Hardware: dxr_opacity_hardware fails by design, as the review asked. All 43 mismatches are committed_hit, and each is also counted in committed_t_plus_tmin. The count matches the 43 shader-committed rays measured at f069a47. The log prints 16 of the 43 rays. In each of them, the committed distance is the candidate distance recorded at the shader's commit (shader_commit_t) plus 0.25. For example, ray 1 has expected ... distance=1 and actual ... distance=1.25 shader_commit_t=1. In 13 of the 16, the committed geometry is the reference's closest hit. Rays 16, 17 and 19 set RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH (flag bit 0x4) and commit geometry 2 at shader_commit_t=3, which is a legal first hit. No other distance error is reported.
  • WARP: the same counts as at f069a47.
  • Other tests: dxr_query, dxr_update and dxr_facing pass on both backends with debug_errors=0 debug_warnings=0.

AI-assisted (Claude Code).

**@⁠denn0x** on GitHub · 2026-11-22 07:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#issuecomment-7076078123) Rerun of the merged revision at `7f13b7f` (`main`), as promised above. The environment is the same machine: RX 9070 XT (driver 32.0.32015.7029) and WARP 10.0.26100.9818, Windows 11 build 26200, MSVC 19.50.35720, Windows SDK 10.0.26100.0, with the D3D12 debug layer enabled on both backends. ```powershell cmake --preset dev cmake --build --preset dev ctest --preset dev --no-tests=error -R '^dxr_(query|update|facing|opacity)_(warp|hardware)$' -V ``` ```text 45: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=43 committed_hit=43 committed_t_plus_tmin=43 45: debug_errors=0 debug_warnings=0 70: dxr_opacity rays=126 hits=94 shader_commits=42 misses=32 first_hit_rays=36 mismatches=0 warp_after_commit=11 committed_t_plus_tmin=0 70: debug_errors=0 debug_warnings=0 88% tests passed, 1 tests failed out of 8 ``` - **Hardware:** `dxr_opacity_hardware` fails by design, as the review asked. All 43 mismatches are `committed_hit`, and each is also counted in `committed_t_plus_tmin`. The count matches the 43 shader-committed rays measured at `f069a47`. The log prints 16 of the 43 rays. In each of them, the committed distance is the candidate distance recorded at the shader's commit (`shader_commit_t`) plus 0.25. For example, ray 1 has `expected ... distance=1` and `actual ... distance=1.25 shader_commit_t=1`. In 13 of the 16, the committed geometry is the reference's closest hit. Rays 16, 17 and 19 set `RAY_FLAG_ACCEPT_FIRST_HIT_AND_END_SEARCH` (flag bit `0x4`) and commit geometry 2 at `shader_commit_t=3`, which is a legal first hit. No other distance error is reported. - **WARP:** the same counts as at `f069a47`. - **Other tests:** `dxr_query`, `dxr_update` and `dxr_facing` pass on both backends with `debug_errors=0 debug_warnings=0`. _AI-assisted (Claude Code)._
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-21 18:58 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9a73480357

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-21 18:58 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/216#pullrequestreview-6007469608) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `9a73480357` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.