Skip to content

LiteFX::Rendering::IGraphicsDevice::computeAccelerationStructureSizes

Computes the required amount of device memory for an IBottomLevelAccelerationStructure.

Synopsis

Declared in <litefx/rendering_api.hpp>

[[dllimport, dllexport]] void computeAccelerationStructureSizes(
    IBottomLevelAccelerationStructure const& blas,
    UInt64& bufferSize,
    UInt64& scratchSize,
    bool forUpdate = false) const;

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
blasThe bottom-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.