FLidarGpuTrace
The scale path for the trace. A grenade is thousands of rays in one frame, which is a dispatch, not a loop of physics queries — but it is the SAME pattern the CPU trace walks, so a shot fired here and a shot re-traced on a client that fell back to the CPU produce the same cloud.
- Module
- Game
- Header
#include "PointCloud/LidarGpuTrace.h"- Namespace
Mowo
Output is a dense record per ray rather than an atomically appended list: the index is the ray index, so the buffer is reproducible and a hit can be matched back to the ray that found it.
Public functions
| Returns | Name | Description |
|---|---|---|
bool | IsSupported | True when the device can run the trace at all. |
bool | Initialize | |
void | Shutdown | |
bool | IsInitialized | |
uint32_t | GetMaxRays | |
bool | Dispatch | Records the dispatch into the current command buffer. |
uint32_t | ReadBack | Blocking readback of the last dispatch. |
uint32_t | ResolveHits | Turns raw records into hits, resolving each point's colour from the surface of the instance the ray landed on. |
Function details
IsSupported
static bool IsSupported()True when the device can run the trace at all. Needs inline ray query for the traversal and 64-bit ints for the vertex fetch that resolves normals.
Initialize
bool Initialize(uint32_t maxRaysPerDispatch)Shutdown
void Shutdown()IsInitialized
bool IsInitialized() constGetMaxRays
uint32_t GetMaxRays() constDispatch
bool Dispatch(const FLidarShot& shot, Ref<AccelerationStructure> tlas, Ref<StorageBuffer> instanceData)Records the dispatch into the current command buffer. instanceData is the renderer's per-instance record buffer for the same TLAS.
ReadBack
uint32_t ReadBack(const FLidarShot& shot, std::vector<HitRecord>& outRecords)Blocking readback of the last dispatch. The caller must have synchronized first — this does not order itself against the frame.
ResolveHits
static uint32_t ResolveHits(const HitRecord* records, uint32_t count, const ESurfaceType* instanceSurfaces, uint32_t surfaceCount, const uint8_t* instanceDynamic, std::vector<FLidarHit>& outHits)Turns raw records into hits, resolving each point's colour from the surface of the instance the ray landed on. instanceSurfaces and instanceDynamic are indexed by TLAS instance id — the renderer's GetRaySceneSurfaces / GetRaySceneDynamicFlags hand them over directly for a live-scene trace. A short table degrades to Default rather than reading out of bounds.