flowchart TB
subgraph build["BuildRaytracingAccelerationStructure (replay)"]
M4a["Metal 4 command buffer
committed before the run"] --> K["Metal 4 kernels:
headers, triangle gather,
instance descs → Metal"]
K --> M3["Metal 3 queue:
build into an
MTLAccelerationStructure"]
M3 -- "shared event" --> M4b["next Metal 4
command buffer waits"]
end
K -. "writes 16 bytes at the D3D12 VA" .-> H["header
{MTLResourceID, instances}
+ contributions at VA + 16"]
M3 -. "table keyed by VA" .-> H
subgraph shader["RayQuery in DXIL"]
S["RTAS SRV or root SRV
= a 64-bit VA"] --> C["dxil-spirv: ConvertUToAS
SPIRV-Cross patch: read the header"]
C --> Q["MSL intersection_query
on instance_acceleration_structure"]
end
H --> C
H -. "contribution lookup
(dxil-spirv patch 0002)" .-> Q