D3D12.X: a singular TLAS instance gets a zero world-to-object matrix #1767
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1767
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1767/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@b3IKK on GitHub · 2026-11-24 20:24 UTC · original
b3IKK:d3d12x/bvh-singular-instance-inverse→main· +32 −0 · 1 files · 1 commits · closed without mergingAddresses
XCL-BT-021from #1488.bvh::world_to_objectdivided the adjugate by the determinant without looking at it: a TLAS instance whose transform is singular — a zero scale on one axis, say — got aNaN/Infworld-to-object matrix in its instance node, so the shader's object-space ray became NaN. An instance of no volume is simply never hit, so the matrix cannot carry an inverse at all.This writes zeros for a singular (or non-finite) inverse: every point maps to the object origin and every direction to 0, which the triangle test misses — no NaN reaches the shader.
What is in it
crates/xcl/src/gpu/bvh.rs:world_to_objectreturns[0.0; 12]when the determinant is zero or the inverse is not finite; add testa_singular_instance_transform_has_a_zero_inverse(a y-squashed instance, then the same instance with full rank). Fails onmainwithleft: [NaN, NaN, …, inf, …], right: [0.0; 12].Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2609.5, debug (scripts/test.ps1) and release (scripts/smoke.ps1).\scripts\test.ps1(cargo build --workspace+cargo test --workspace -- --test-threads=4): 960 passed, 0 failed, 43 ignored (SKIPPED: the wave64 / direct-DXIL per-lane tests that need 64-lane hardware or a semantics mode this adapter refuses,no heap windows, andcannot disable the driver cache (Windows Developer Mode is required))cargo test -p xcl --lib bvh: 8 passed, 0 failedRegression run
main (
c4d37be, clean tree, no local changes):PR (
582f45a, clean tree, no local changes):Not tested
XboxBvhBuilder(no game here does; the builder and its test are XCL's own)AI use
XCL-BT-021againstworld_to_object/build_top, wrote the guard and test (and confirmed it fails without it), rebased ontoc4d37be, ran the test suite andscripts/smoke.ps1regression runs with #677's title hashing, and drafted this PR description.@b3IKK on GitHub · 2026-11-24 21:29 UTC · original
Rebased onto
c4d37beand re-ran both with the current scripts/smoke.ps1 (#677's hashed itle: line): 960 passed, 0 failed, 43 ignored.@futurepro62 on GitHub · 2026-11-24 21:23 UTC · original · edited 2026-11-24 22:03 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
d3d6e63(on its basec160d86).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 858 passed, 0 failed, 42 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.a_singular_instance_transform_has_a_zero_inverse.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4: 859 passed, 0 failed, 42 ignored. SKIPPED:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipon NVIDIA. Both fail on main7f7e768too, not because of this PR: underXCL_REQUIRE_GPU=mesh,runner::skip_testturns their skips into failures.heap_window_out_of_memory_falls_back_to_the_switch_formskips whenXCL_HEAP_WINDOWSis unset (#1651), andshaders::tests::pso_measurement_compiles_an_exact_synthetic_recordskips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not setXCL_REQUIRE_GPU, so there both just print SKIPPED.Not tested
AI use
@b3IKK on GitHub · 2026-11-25 00:03 UTC · original
Closing in favour of #1521, which came first and makes the same change (#1607, group D52):
world_to_objectreturns zeros for a singular or non-finite transform. AI use: OpenCode, Claude Fable 5.2.github-bot referenced this pull request2026-11-26 06:18:30 +00:00
Pull request closed