diff options
| author | NiiRoZz <simonin.remi25@gmail.com> | 2026-11-23 00:26:38 +0100 |
|---|---|---|
| committer | NiiRoZz <simonin.remi25@gmail.com> | 2026-11-23 00:26:38 +0100 |
| commit | ba288b5b5c28236b21f01c1d4a1de3cc7cd90731 (patch) | |
| tree | 71276f868f6aeb3472c1919acd24ea4e9972f6bc /runtime/test/gameinput_test.cpp | |
| parent | c2f3eaa308a2c67a48987e772f7feea3a16b519c (diff) | |
XDXR builder: radix-tree BVH (Karras) instead of four consecutive children (D3D-410)
The GPU builder grouped four consecutive Morton-sorted elements per node,
level by level. Those groups ignore where the Morton prefix changes, so
sibling boxes overlapped and a ray took about twice the traversal steps.
It now builds a binary radix tree over the same sorted keys (Karras 2012,
ties broken by sorted position) and keeps the inner nodes at an even depth
as the BOX32/BOX16 nodes, each taking its children's children (2 to 4),
numbered in sorted order by a scan (root = node 0). Boxes are filled by one
bottom-up pass: each element writes its slot box and merges it into its
parent's accumulator with atomics; the last child to arrive carries on.
The arrival counter's atomicAdd has acquire-release semantics instead of a
memoryBarrierBuffer, since the pass is divergent and SPIRV-Cross before
MSL 3.2 lowers memory barriers to threadgroup_barrier. Refit reuses the pass
through the parent table.
TRI1 pairing (#3315) pairs triangle children of one node; the build records
each element's tree pointer so a paired sibling finds its TRI1 slot. The
node count depends on the keys: the layout reserves (3N - 2) / 4 nodes, the
header counts the nodes written (plus the BOX16 spare unit after the last
one), so compaction gives the rest back. Refit copies a source by its
header size. check-build reports traversal steps per ray.
Steps per ray: 5,000 random triangles 42.0 -> 23.0, BOX16 43.9 -> 23.7,
paired 7,200-triangle grid 37.6 -> 19.5. Build 1M triangles: RTX 5090
5.50 -> 5.99 ms, Radeon gfx1036 iGPU 133 -> 180 ms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/test/gameinput_test.cpp')
0 files changed, 0 insertions, 0 deletions