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

Closed
abnalstlll-byte wants to merge 1 commit from upstream-pr/743 into main
abnalstlll-byte commented 2026-11-24 13:19:33 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T13:19:33Z.


### 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).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5472918637 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/743). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T13:19:33Z. --- ### 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).
SweatierKey commented 2026-11-24 14:33:14 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by SweatierKey on 2026-11-24T14:33:14Z.

Review: APPROVED


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.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041147834 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/743#pullrequestreview-6041147834). Originally posted by [SweatierKey](https://github.com/SweatierKey) on 2026-11-24T14:33:14Z. **Review:** APPROVED --- 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.
aslan2142 commented 2026-11-24 22:33:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T22:33:55Z.


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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7146381971 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/743#issuecomment-7146381971). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T22:33:55Z. --- 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

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
ProjectLeonida/mandy!743
No description provided.