xdxr_bvh: handle D3D12 inactive primitives and NaN bounds (OLD-10063) #743

Closed
github-bot wants to merge 1 commit from gh-pr/743/head into gh-pr/743/base
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 13:19 UTC · original
abnalstlll-byte:restore/old-10063-xdxr-bvh-inactive → main · +181 −34 · 2 files · 1 commits · closed without merging

### Summary
Restores and updates work from draft PR #329 (old-pr/10063 / item OLD-10063).
Original commit by @⁠ShotTechOp (c90d09b7092).

In D3D12 / DirectX Raytracing, inactive primitives are marked by setting a vertex coordinate to NaN (e.g. v0.x = NaN). Previously, tools/xdxr_bvh.py would crash or produce corrupt node bounding boxes when encountering NaN coordinates in triangles or inactive TLAS instances.

This change:

  • Generates empty boxes (+inf, -inf) for inactive (NaN) triangles and never pairs them.
  • Prevents NaNs from propagating into parent bounds or child boxes.
  • Properly handles inactive TLAS instances (null BLAS, singular transforms, zero masks).
  • Handles edge cases where all triangles in a BLAS are inactive (empty bounds, valid miss on traversal).

Verification

  • python -I scripts/check_no_game_data.py tools/xdxr_bvh.py tests/test_xdxr_bvh.py -> Clean (no game data)
  • python -m unittest tests/test_xdxr_bvh.py -> 53/53 PASS in 1.75s
  • Clean rebase onto latest ubi/main (21625bca8).

AI-assisted verification and rebase by Antigravity (Autonomous Direct Mode).

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 13:19 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/743) `abnalstlll-byte:restore/old-10063-xdxr-bvh-inactive` → `main` · +181 −34 · 2 files · 1 commits · closed without merging ### Summary Restores and updates work from draft PR #329 (`old-pr/10063` / item `OLD-10063`). Original commit by @⁠ShotTechOp (`c90d09b7092`). In D3D12 / DirectX Raytracing, inactive primitives are marked by setting a vertex coordinate to NaN (e.g. `v0.x = NaN`). Previously, `tools/xdxr_bvh.py` would crash or produce corrupt node bounding boxes when encountering NaN coordinates in triangles or inactive TLAS instances. This change: - Generates empty boxes (`+inf, -inf`) for inactive (NaN) triangles and never pairs them. - Prevents NaNs from propagating into parent bounds or child boxes. - Properly handles inactive TLAS instances (null BLAS, singular transforms, zero masks). - Handles edge cases where all triangles in a BLAS are inactive (empty bounds, valid miss on traversal). ### Verification - `python -I scripts/check_no_game_data.py tools/xdxr_bvh.py tests/test_xdxr_bvh.py` -> Clean (no game data) - `python -m unittest tests/test_xdxr_bvh.py` -> 53/53 PASS in 1.75s - Clean rebase onto latest `ubi/main` (`21625bca8`). AI-assisted verification and rebase by Antigravity (Autonomous Direct Mode).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:19:02 +00:00
github-bot closed this pull request 2026-11-26 09:19:02 +00:00
Author
Owner

@⁠SweatierKey on GitHub · 2026-11-24 14:33 UTC · original · approved these changes

Independent clean-room audit and verification applied cleanly on main@d0da7dade:

  • python3 -I tests/test_xdxr_bvh.py: 53/53 passed in 0.91s (covering inactive NaN triangles, all-inactive BLAS, inactive TLAS instances, zero-length edge pairing skip, NaN box test miss, and validator NaN rejection).
  • python3 -I scripts/check_no_game_data.py: PASS.

Clean diff; no game data. AI-assisted: yes.

**@⁠SweatierKey** on GitHub · 2026-11-24 14:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/743#pullrequestreview-6041147834) · **approved these changes** Independent clean-room audit and verification applied cleanly on `main@d0da7dade`: - `python3 -I tests/test_xdxr_bvh.py`: 53/53 passed in 0.91s (covering inactive NaN triangles, all-inactive BLAS, inactive TLAS instances, zero-length edge pairing skip, NaN box test miss, and validator NaN rejection). - `python3 -I scripts/check_no_game_data.py`: PASS. Clean diff; no game data. AI-assisted: yes.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-24 22:33 UTC · original

Thanks for restoring this. I'm closing it as a duplicate of #598.

  • #598 carries the same commit from old-pr/10063 (git patch-id --stable matches), plus a fix that makes invert_affine() reject non-finite values.
  • #598 has the valid claim in #14: claiming: OLD-10063 at 09:38 UTC, posted before it opened. #14 has no claiming: line for this item from this account.
  • For future restorations, please post claiming: <item> in #14 before opening the pull request.

AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-24 22:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/743#issuecomment-7146381971) Thanks for restoring this. I'm closing it as a duplicate of #598. - #598 carries the same commit from `old-pr/10063` (`git patch-id --stable` matches), plus a fix that makes `invert_affine()` reject non-finite values. - #598 has the valid claim in #14: `claiming: OLD-10063` at 09:38 UTC, posted before it opened. #14 has no `claiming:` line for this item from this account. - For future restorations, please post `claiming: <item>` in #14 before opening the pull request. AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5).

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.