@pmndrs/bvh
    Preparing search index...

    Class GpuBvhRefit

    Owns the refit's pipelines and its own buffers (topology, scratch, stats, parameters). The tree and the primitive boxes belong to the caller.

    Index
    latestStats: BvhRefitStats | null = null

    The newest stats read back, or null before the first.

    • Stats readback, part 2: after encode, copies this refit's stats out unless an earlier copy is still being read. Does nothing unless diagnostics is on.

      Parameters

      • encoder: GPUCommandEncoder

      Returns void

    • Records the refit into pass: the clear, the climb and the repair (which returns at once unless the climb gave up). tree holds the nodes at the shape's nodeWordOffset; primitiveBoxes holds PRIMITIVE_BOX_FLOATS floats per primitive and must be written by an earlier dispatch or command.

      Parameters

      • pass: GPUComputePassEncoder
      • tree: GPUBuffer
      • primitiveBoxes: GPUBuffer

      Returns void

    • The refit needs subgroups; without them a caller uses its declared fallback (a CPU build).

      Parameters

      • device: GPUDevice

      Returns boolean

    • Stats readback, part 1, without ever waiting: call at the start of a frame. It maps the copy copyStats recorded in an earlier frame (the host has submitted that frame by now); latestStats updates when the mapping resolves.

      Returns void

    • Compiles the kernels (asynchronously, so the main thread doesn't stall), or waits for the shared ones.

      Returns Promise<void>

    • Moves the tree the shape refits to another place in the node buffer (nodeWordOffset), keeping the shape.

      Parameters

      • nodeWordOffset: number

      Returns void

    • Takes a new tree shape. Its buffers are written with queue.writeBuffer, so they are in place for the next submit.

      Parameters

      Returns void