upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_backend.h
diff options
context:
space:
mode:
authorromainveurrier <romain.veurrier@gmail.com>2026-11-22 15:09:14 +0100
committerromainveurrier <romain.veurrier@gmail.com>2026-11-22 15:09:14 +0100
commitf6d6121c9c54d406f1cfc8791df628a82dc673d8 (patch)
treedd1908feabb57fb4295226d3e506cd4b3d6bfc10 /runtime/src/vulkan_backend.h
parentfa2712e2b00f639906d4de63aa5ec326a1fa2b37 (diff)
XDXR builds: PERFORM_UPDATE refits instead of rebuilding
An update (same topology, new positions or instance transforms) now keeps the source's tree and recomputes its boxes: the source is copied to the destination unless it is the destination (MODE_COPY), the elements are rewritten at their slots, MODE_LEVEL with arg2 = 1 recomputes each node's boxes from the children it already points to, and the header gets the new bounds. No Morton pass, no sort, and the parent table is kept. RTX 2050: 1,000 triangles 0.07 ms (build 0.19), 100,000 1.02 ms (2.24), 1,000,000 9.8 ms (22.0); Iris Xe 13.1 ms for 1M (47.9). - XdxrBuilder::record_blas / record_tlas take `update_from`; the Vulkan backend passes the source (or the destination, for an in-place update) when the D3D12 build has PERFORM_UPDATE. - vk_xdxr_build_test: a 3,000-triangle BLAS refitted in place (radix-sort tree), an R32-indexed grid refitted into another buffer (its untouched source is checked too), and the TLAS refitted after its instances move; the timing mode also times refits. - d3d12_xdxr_rt_test: the BLAS is built with ALLOW_UPDATE, its soup moves, and a PERFORM_UPDATE in place is checked as d3d12_blas_update. - tools/xdxr_bvh.py check-build: the case being checked answers reads at its address first (an in-place update leaves two dumps at one address). A sabotaged refit (no box pass) fails every update case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/vulkan_backend.h')
-rw-r--r--runtime/src/vulkan_backend.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index d4b6b00a7..0d73bb2de 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -732,13 +732,16 @@ public:
732 const std::uint64_t base = replay_.heap_base; 732 const std::uint64_t base = replay_.heap_base;
733 XdxrLayout layout; 733 XdxrLayout layout;
734 layout.compute(xdxr_elements(b), b.is_tlas); 734 layout.compute(xdxr_elements(b), b.is_tlas);
735 // PERFORM_UPDATE refits the source (the destination itself when no source is given, as D3D12
736 // allows for an in-place update); a full build otherwise.
737 const std::uint64_t from = b.update ? base + (b.src_va ? b.src_va : b.dst_va) : 0;
735 if (b.is_tlas) { 738 if (b.is_tlas) {
736 xdxr_->record_tlas(cb, layout, b.instances_va ? base + b.instances_va : 0, base + b.dst_va, 739 xdxr_->record_tlas(cb, layout, b.instances_va ? base + b.instances_va : 0, base + b.dst_va,
737 base + b.scratch_va, base); 740 base + b.scratch_va, base, from);
738 } else { 741 } else {
739 std::vector<XdxrTriangles> geometries; 742 std::vector<XdxrTriangles> geometries;
740 xdxr_inputs(b, &geometries, base); 743 xdxr_inputs(b, &geometries, base);
741 xdxr_->record_blas(cb, layout, geometries, base + b.dst_va, base + b.scratch_va); 744 xdxr_->record_blas(cb, layout, geometries, base + b.dst_va, base + b.scratch_va, from);
742 } 745 }
743 }; 746 };
744 } else { 747 } else {