diff options
| author | romainveurrier <romain.veurrier@gmail.com> | 2026-11-22 13:19:18 +0100 |
|---|---|---|
| committer | romainveurrier <romain.veurrier@gmail.com> | 2026-11-22 13:19:18 +0100 |
| commit | 86f7e9f887414809b7dbccce95e40072a5a261ed (patch) | |
| tree | 3bf013692b0257ab262789a22a39eaa353534f4c /runtime/src/tls_host.cpp | |
| parent | 854d4100f0a8c3fd10b9db1167f4c870b45b28fd (diff) | |
Runtime: build XDXR BVH4 acceleration structures on the GPU
The game's translated ray-tracing shaders read the console's BVH records
themselves (docs/d3d12_vulkan.md 4.8), so the layer has to write them. This
adds the GPU builder, checked against tools/xdxr_bvh.py:
- src/xdxr_build.comp: one pipeline, one dispatch per step. Triangle leaves
(any of R32G32B32/R32G32 vertices, none/R16/R32 indices, a stride, an
optional 3x4 transform) or 128-byte INSTANCE records with world-to-object
inverses; Morton keys and a bitonic sort; BOX32 nodes four consecutive
children at a time, level by level, with the parent table; the header.
Buffer device addresses as uvec2: needs bufferDeviceAddress, not
shaderInt64. NaN triangles, mask-0 instances, instances without a BLAS and
singular transforms get empty boxes.
- src/xdxr_build.h: XdxrLayout (exact result and scratch sizes from the
element count, for the prebuild info too) and XdxrBuilder (records the
dispatches). A bias maps the application's 40-bit BLAS addresses to device
addresses.
- test/vk_xdxr_build_test.cpp: nine synthetic cases built on the GPU and
dumped; ctest `xdxr_build` + `xdxr_build_check`, which runs
`tools/xdxr_bvh.py check-build`: validate, then trace 1000 rays per case
against brute force.
- vk_test_device.h: opt-in bufferDeviceAddress (request_buffer_device_address,
device_address()).
- tools/xdxr_bvh.py: check-build; trace takes the bias; instances without a
BLAS and inactive triangles are valid.
Not wired to BuildRaytracingAccelerationStructure yet: that path builds a
VkAccelerationStructureKHR today (#743), and which one the layer uses is a
maintainer decision.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/src/tls_host.cpp')
0 files changed, 0 insertions, 0 deletions