Skip to content

LiteFX::Rendering::GraphicsDevice::computeAccelerationStructureSizes

Computes the required amount of device memory for an ITopLevelAccelerationStructure.

Synopsis

Declared in <litefx/rendering.hpp>

virtual void computeAccelerationStructureSizes(
    top_level_acceleration_structure_type const& tlas,
    UInt64& bufferSize,
    UInt64& scratchSize,
    bool forUpdate = false) const = 0;

Description

Acceleration structures are built on the GPU, which requires additional memory called scratch memory. When creating an acceleration structure (AS), you have to provide a temporary buffer containing the scratch memory, alongside the actual buffer that stores the AS itself. This method can be used to pre-compute the buffer sizes for both buffers.

This method is only supported, if the GraphicsDeviceFeatures::RayTracing feature is enabled.

Parameters

NameDescription
tlasThe top-level acceleration structure to compute the memory requirements for.
bufferSizeThe size of the acceleration structure buffer.
scratchSizeThe size of the scratch memory buffer.
forUpdateIf set to true, scratchSize will contain the amount of scratch memory required for an update.