NVIDIA OptiX 7.1 API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Acceleration structures

Functions

OptixResult optixAccelComputeMemoryUsage (OptixDeviceContext context, const OptixAccelBuildOptions *accelOptions, const OptixBuildInput *buildInputs, unsigned int numBuildInputs, OptixAccelBufferSizes *bufferSizes)
 
OptixResult optixAccelBuild (OptixDeviceContext context, CUstream stream, const OptixAccelBuildOptions *accelOptions, const OptixBuildInput *buildInputs, unsigned int numBuildInputs, CUdeviceptr tempBuffer, size_t tempBufferSizeInBytes, CUdeviceptr outputBuffer, size_t outputBufferSizeInBytes, OptixTraversableHandle *outputHandle, const OptixAccelEmitDesc *emittedProperties, unsigned int numEmittedProperties)
 
OptixResult optixAccelGetRelocationInfo (OptixDeviceContext context, OptixTraversableHandle handle, OptixAccelRelocationInfo *info)
 
OptixResult optixAccelCheckRelocationCompatibility (OptixDeviceContext context, const OptixAccelRelocationInfo *info, int *compatible)
 
OptixResult optixAccelRelocate (OptixDeviceContext context, CUstream stream, const OptixAccelRelocationInfo *info, CUdeviceptr instanceTraversableHandles, size_t numInstanceTraversableHandles, CUdeviceptr targetAccel, size_t targetAccelSizeInBytes, OptixTraversableHandle *targetHandle)
 
OptixResult optixAccelCompact (OptixDeviceContext context, CUstream stream, OptixTraversableHandle inputHandle, CUdeviceptr outputBuffer, size_t outputBufferSizeInBytes, OptixTraversableHandle *outputHandle)
 
OptixResult optixConvertPointerToTraversableHandle (OptixDeviceContext onDevice, CUdeviceptr pointer, OptixTraversableType traversableType, OptixTraversableHandle *traversableHandle)
 

Detailed Description

Function Documentation

OptixResult optixAccelBuild ( OptixDeviceContext  context,
CUstream  stream,
const OptixAccelBuildOptions accelOptions,
const OptixBuildInput buildInputs,
unsigned int  numBuildInputs,
CUdeviceptr  tempBuffer,
size_t  tempBufferSizeInBytes,
CUdeviceptr  outputBuffer,
size_t  outputBufferSizeInBytes,
OptixTraversableHandle outputHandle,
const OptixAccelEmitDesc emittedProperties,
unsigned int  numEmittedProperties 
)
Parameters
[in]context
[in]stream
[in]accelOptionsaccel options
[in]buildInputsan array of OptixBuildInput objects
[in]numBuildInputsmust be >= 1 for GAS, and == 1 for IAS
[in]tempBuffermust be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT
[in]tempBufferSizeInBytes
[in]outputBuffermust be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT
[in]outputBufferSizeInBytes
[out]outputHandle
[out]emittedPropertiestypes of requested properties and output buffers
[in]numEmittedPropertiesnumber of post-build properties to populate (may be zero)
OptixResult optixAccelCheckRelocationCompatibility ( OptixDeviceContext  context,
const OptixAccelRelocationInfo info,
int *  compatible 
)

Checks if an acceleration structure built using another OptixDeviceContext (that was used to fill in 'info') is compatible with the OptixDeviceContext specified in the 'context' parameter.

Any device is always compatible with itself.

Parameters
[in]context
[in]info
[out]compatibleIf OPTIX_SUCCESS is returned 'compatible' will have the value of either:
  • 0: This context is not compatible with acceleration structure data associated with 'info'.
  • 1: This context is compatible.
OptixResult optixAccelCompact ( OptixDeviceContext  context,
CUstream  stream,
OptixTraversableHandle  inputHandle,
CUdeviceptr  outputBuffer,
size_t  outputBufferSizeInBytes,
OptixTraversableHandle outputHandle 
)

After building an acceleration structure, it can be copied in a compacted form to reduce memory. In order to be compacted, OPTIX_BUILD_FLAG_ALLOW_COMPACTION must be supplied in OptixAccelBuildOptions::buildFlags passed to optixAccelBuild.

'outputBuffer' is the pointer to where the compacted acceleration structure will be written. This pointer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT.

The size of the memory specified in 'outputBufferSizeInBytes' should be at least the value computed using the OPTIX_PROPERTY_TYPE_COMPACTED_SIZE that was reported during optixAccelBuild.

Parameters
[in]context
[in]stream
[in]inputHandle
[in]outputBuffer
[in]outputBufferSizeInBytes
[out]outputHandle
OptixResult optixAccelComputeMemoryUsage ( OptixDeviceContext  context,
const OptixAccelBuildOptions accelOptions,
const OptixBuildInput buildInputs,
unsigned int  numBuildInputs,
OptixAccelBufferSizes bufferSizes 
)
Parameters
[in]contextdevice context of the pipeline
[in]accelOptionsaccel options
[in]buildInputsan array of OptixBuildInput objects
[in]numBuildInputsnumber of elements in buildInputs (must be at least 1)
[out]bufferSizesfills in buffer sizes
OptixResult optixAccelGetRelocationInfo ( OptixDeviceContext  context,
OptixTraversableHandle  handle,
OptixAccelRelocationInfo info 
)

Obtain relocation information, stored in OptixAccelRelocationInfo, for a given context and acceleration structure's traversable handle.

The relocation information can be passed to optixAccelCheckRelocationCompatibility to determine if an acceleration structure, referenced by 'handle', can be relocated to a different device's memory space (see optixAccelCheckRelocationCompatibility).

When used with optixAccelRelocate, it provides data necessary for doing the relocation.

If the acceleration structure data associated with 'handle' is copied multiple times, the same OptixAccelRelocationInfo can also be used on all copies.

Parameters
[in]context
[in]handle
[out]info
Returns
OPTIX_ERROR_INVALID_VALUE will be returned for traversable handles that are not from acceleration structure builds.
OptixResult optixAccelRelocate ( OptixDeviceContext  context,
CUstream  stream,
const OptixAccelRelocationInfo info,
CUdeviceptr  instanceTraversableHandles,
size_t  numInstanceTraversableHandles,
CUdeviceptr  targetAccel,
size_t  targetAccelSizeInBytes,
OptixTraversableHandle targetHandle 
)

optixAccelRelocate is called to update the acceleration structure after it has been relocated. Relocation is necessary when the acceleration structure's location in device memory has changed. optixAccelRelocate does not copy the memory. This function only operates on the relocated memory who's new location is specified by 'targetAccel'. optixAccelRelocate also returns the new OptixTraversableHandle associated with 'targetAccel'. The original memory (source) is not required to be valid, only the OptixAccelRelocationInfo.

Before copying the data and calling optixAccelRelocate, optixAccelCheckRelocationCompatibility should be called to ensure the copy will be compatible with the destination device context.

The memory pointed to by 'targetAccel' should be allocated with the same size as the source acceleration. Similar to the 'outputBuffer' used in optixAccelBuild, this pointer must be a multiple of OPTIX_ACCEL_BUFFER_BYTE_ALIGNMENT.

The memory in 'targetAccel' must be allocated as long as the accel is in use.

When relocating an accel that contains instances, 'instanceTraversableHandles' and 'numInstanceTraversableHandles' should be supplied. These are the traversable handles of the instances. These can be used when also relocating the instances. No updates to the bounds are performed. Use optixAccelBuild to update the bounds. 'instanceTraversableHandles' and 'numInstanceTraversableHandles' may be zero when relocating bottom level accel (i.e. an accel with no instances).

Parameters
[in]context
[in]stream
[in]info
[in]instanceTraversableHandles
[in]numInstanceTraversableHandles
[in]targetAccel
[in]targetAccelSizeInBytes
[out]targetHandle
OptixResult optixConvertPointerToTraversableHandle ( OptixDeviceContext  onDevice,
CUdeviceptr  pointer,
OptixTraversableType  traversableType,
OptixTraversableHandle traversableHandle 
)
Parameters
[in]onDevice
[in]pointerpointer to traversable allocated in OptixDeviceContext. This pointer must be a multiple of OPTIX_TRANSFORM_BYTE_ALIGNMENT
[in]traversableTypeType of OptixTraversableHandle to create
[out]traversableHandletraversable handle. traversableHandle must be in host memory