[PR #598] [MERGED] xdxr_bvh: handle D3D12 inactive primitives and NaN bounds (OLD-10063) #640

Closed
opened 2026-11-26 20:18:33 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/598
Author: @jarvixaiassistant-glitch
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @aslan2142

Base: main ← Head: fix/old-10063-xdxr-bvh-nan-inactive


📝 Commits (2)

  • 9e105b9 xdxr_bvh: handle D3D12 inactive primitives and NaN bounds
  • 428f941 xdxr_bvh: reject non-finite determinant or inverse in invert_affine

📊 Changes

2 files changed (+202 additions, -37 deletions)

View changed files

📝 tests/test_xdxr_bvh.py (+116 -0)
📝 tools/xdxr_bvh.py (+86 -37)

📄 Description

Claimed in the coordination issue as: OLD-10063

What and why

Carries forward old-pr/10063 (draft #329) onto main (d7576d56a), preserving ShotTechOp's original commit verbatim per CONTRIBUTING.md and adding one focused hardening commit on top:

  1. Original commit (ShotTechOp): Updates tools/xdxr_bvh.py to handle D3D12 inactive triangles (NaN vertices → empty box (+inf, -inf), never paired; zero-length edges skipped during pairing), inactive TLAS instances (blas_va == 0, zero mask, empty blas_bounds, or NaN-transformed corners → empty world box), NaN-safe _box_test, and explicit NaN child-box rejection in validate(), plus synthetic unit tests in tests/test_xdxr_bvh.py.
  2. Hardening commit (JARVIX): Updates invert_affine() in tools/xdxr_bvh.py to reject non-finite determinants (not math.isfinite(det)) and non-finite inverse entries. Previously, a NaN in an inactive TLAS instance's rotation or translation bypassed det == 0 and packed NaN floats into the instance record's inverse matrix instead of triggering build_tlas()'s zero-matrix fallback. Adds test_nan_transform_falls_back_to_zero_inverse_in_tlas covering both rotation and translation NaNs.

Tested

All synthetic CPU/stdlib/docs checks on Windows 11 x64, Python 3.12.14, Node v24.19.0 (no game files):

  • python -I tests/test_xdxr_bvh.py -v — 54/54 passed (reproduced invert_affine() returning all-NaN before the hardening commit; 54/54 pass after)
  • python -I scripts/check_no_game_data.py — passed (0 forbidden tracked extensions)
  • python -m compileall -q make_game.py tools tests — passed
  • python -I tests/test_text_write_line_endings.py, tests/test_report_paths.py, tests/test_i18n_index.py, and all tests/test_docs_*.py — passed
  • node --test tests/test_viewer_streaming.cjs — passed

GPUs tested: n/a (CPU BVH reference / unit tests only)

AI-assisted: yes (JARVIX multi-model team: Antigravity + DeepSeek-V4-Pro + NVIDIA NIM Nemotron-3.5-Lightning & Nemotron-3-Ultra-550B)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (N/A — CPU BVH reference tool only, no shader-translator rule changed.)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/598 **Author:** [@jarvixaiassistant-glitch](https://github.com/jarvixaiassistant-glitch) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `fix/old-10063-xdxr-bvh-nan-inactive` --- ### 📝 Commits (2) - [`9e105b9`](https://github.com/ubiquitarianism/leonida/commit/9e105b9209c56d3815596348358d9a4b8ce27fa3) xdxr_bvh: handle D3D12 inactive primitives and NaN bounds - [`428f941`](https://github.com/ubiquitarianism/leonida/commit/428f9419d9932eeffd59e6d38a8ef0fe57509a66) xdxr_bvh: reject non-finite determinant or inverse in invert_affine ### 📊 Changes **2 files changed** (+202 additions, -37 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_xdxr_bvh.py` (+116 -0) 📝 `tools/xdxr_bvh.py` (+86 -37) </details> ### 📄 Description Claimed in the coordination issue as: OLD-10063 ### What and why Carries forward `old-pr/10063` (draft #329) onto `main` (`d7576d56a`), preserving `ShotTechOp`'s original commit verbatim per `CONTRIBUTING.md` and adding one focused hardening commit on top: 1. **Original commit (`ShotTechOp`):** Updates `tools/xdxr_bvh.py` to handle D3D12 inactive triangles (NaN vertices → empty box `(+inf, -inf)`, never paired; zero-length edges skipped during pairing), inactive TLAS instances (`blas_va == 0`, zero mask, empty `blas_bounds`, or NaN-transformed corners → empty world box), NaN-safe `_box_test`, and explicit NaN child-box rejection in `validate()`, plus synthetic unit tests in `tests/test_xdxr_bvh.py`. 2. **Hardening commit (`JARVIX`):** Updates `invert_affine()` in `tools/xdxr_bvh.py` to reject non-finite determinants (`not math.isfinite(det)`) and non-finite inverse entries. Previously, a `NaN` in an inactive TLAS instance's rotation or translation bypassed `det == 0` and packed `NaN` floats into the instance record's inverse matrix instead of triggering `build_tlas()`'s zero-matrix fallback. Adds `test_nan_transform_falls_back_to_zero_inverse_in_tlas` covering both rotation and translation NaNs. ### Tested All synthetic CPU/stdlib/docs checks on Windows 11 x64, Python 3.12.14, Node v24.19.0 (no game files): - `python -I tests/test_xdxr_bvh.py -v` — 54/54 passed (reproduced `invert_affine()` returning all-NaN before the hardening commit; 54/54 pass after) - `python -I scripts/check_no_game_data.py` — passed (0 forbidden tracked extensions) - `python -m compileall -q make_game.py tools tests` — passed - `python -I tests/test_text_write_line_endings.py`, `tests/test_report_paths.py`, `tests/test_i18n_index.py`, and all `tests/test_docs_*.py` — passed - `node --test tests/test_viewer_streaming.cjs` — passed GPUs tested: n/a (CPU BVH reference / unit tests only) AI-assisted: yes (JARVIX multi-model team: Antigravity + DeepSeek-V4-Pro + NVIDIA NIM Nemotron-3.5-Lightning & Nemotron-3-Ultra-550B) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. *(N/A — CPU BVH reference tool only, no shader-translator rule changed.)* --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:33 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#640
No description provided.