[PR #329] [CLOSED] xdxr_bvh: handle D3D12 inactive primitives and NaN bounds #380

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/329
Author: @Andretuta
Created: 11/24/2026
Status: ❌ Closed

Base: main ← Head: old-pr/10063


📝 Commits (1)

  • c90d09b xdxr_bvh: handle D3D12 inactive primitives and NaN bounds

📊 Changes

2 files changed (+181 additions, -34 deletions)

View changed files

📝 tests/test_xdxr_bvh.py (+101 -0)
📝 tools/xdxr_bvh.py (+80 -34)

📄 Description

Carried over from old PR 10063 by ShotTechOp in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10063, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
ShotTechOp: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Summary

Clean rebase onto ProjectLeonida/Leonida main (de4c373) of formerly approved PR #7817 (closed in the bulk PR cleanup sweep), plus @Envyre's non-blocking docstring note on _tri_inactive:

  1. D3D12 inactive primitives & empty BLAS/TLAS handling:
    • Skips inactive triangles (NaN vertices; docstring now notes any-component NaN intentionally matches runtime/src/xdxr_build.comp for static builds) while preserving original primitive IDs.
    • Emits valid empty-box roots for all-inactive BLASes and skips inactive TLAS instances (zero mask, singular transform, or empty BLAS).
  2. Closed-form triangle pairing remap:
    • Skips zero-length shared edges when pairing triangles and replaces order.index() lookups with closed-form slot remap formulas (TRI0 / TRI1), preventing mis-remapping on degenerate/duplicated vertices.
  3. NaN-safe box emptiness, ray-box tests, and validation:
    • Uses not all(lo[c] <= hi[c] ...) in _box_empty() and _box_test() so NaN bounds are treated as empty / ray misses instead of leaking into tnear/tfar.
    • Rejects NaN child boxes in validate().

Coordination & Prior Verification

Testing

Environment: Windows 11 x64, Python 3.12.10, CPU-only (rebased on de4c373).

  • python -I tests/test_xdxr_bvh.py -> 53/53 OK
  • python -m compileall -q tools/xdxr_bvh.py tests/test_xdxr_bvh.py -> exit 0
  • python -I scripts/check_no_game_data.py tools/xdxr_bvh.py tests/test_xdxr_bvh.py -> exit 0
  • git diff --check -> clean

🔄 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/329 **Author:** [@Andretuta](https://github.com/Andretuta) **Created:** 11/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `old-pr/10063` --- ### 📝 Commits (1) - [`c90d09b`](https://github.com/ubiquitarianism/leonida/commit/c90d09b7092344b09c8e01541f01e2e1bde851f3) xdxr_bvh: handle D3D12 inactive primitives and NaN bounds ### 📊 Changes **2 files changed** (+181 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_xdxr_bvh.py` (+101 -0) 📝 `tools/xdxr_bvh.py` (+80 -34) </details> ### 📄 Description > Carried over from **old PR 10063** by `ShotTechOp` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10063`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `ShotTechOp`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ## Summary Clean rebase onto `ProjectLeonida/Leonida` `main` (`de4c373`) of formerly approved PR `#7817` (closed in the bulk PR cleanup sweep), plus `@Envyre`'s non-blocking docstring note on `_tri_inactive`: 1. **D3D12 inactive primitives & empty BLAS/TLAS handling**: - Skips inactive triangles (NaN vertices; docstring now notes any-component NaN intentionally matches `runtime/src/xdxr_build.comp` for static builds) while preserving original `primitive` IDs. - Emits valid empty-box roots for all-inactive BLASes and skips inactive TLAS instances (zero mask, singular transform, or empty BLAS). 2. **Closed-form triangle pairing remap**: - Skips zero-length shared edges when pairing triangles and replaces `order.index()` lookups with closed-form slot remap formulas (`TRI0` / `TRI1`), preventing mis-remapping on degenerate/duplicated vertices. 3. **NaN-safe box emptiness, ray-box tests, and validation**: - Uses `not all(lo[c] <= hi[c] ...)` in `_box_empty()` and `_box_test()` so NaN bounds are treated as empty / ray misses instead of leaking into `tnear`/`tfar`. - Rejects NaN child boxes in `validate()`. ## Coordination & Prior Verification - Claimed in `#9677`: https://github.com/ProjectLeonida/Leonida/issues/9677#issuecomment-7117121412 - Supersedes closed `#7817` (previously **APPROVED** by `@leoleahy`, verified by `@azterixx`, `@Envyre`, `@HansBullet`, `@airp1ane`, and `@wildheathen` on real console structures, and flagged ready to merge in `#8919` triage). - No game files used; synthetic tests only. - AI-assisted: yes (Antigravity). ## Testing Environment: Windows 11 x64, Python 3.12.10, CPU-only (rebased on `de4c373`). - `python -I tests/test_xdxr_bvh.py` -> 53/53 OK - `python -m compileall -q tools/xdxr_bvh.py tests/test_xdxr_bvh.py` -> exit 0 - `python -I scripts/check_no_game_data.py tools/xdxr_bvh.py tests/test_xdxr_bvh.py` -> exit 0 - `git diff --check` -> clean --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:17:42 +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#380
No description provided.