NVIDIA OptiX 6.0 API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
optix_device.h File Reference

Go to the source code of this file.

Classes

struct  rtObject
 
struct  optix::bufferId< T, Dim >
 
struct  optix::bufferId< T, Dim >
 

Macros

#define rtDeclareVariable(type, name, semantic, annotation)
 
#define rtDeclareAnnotation(variable, annotation)
 
#define rtCallableProgram(return_type, function_name, parameter_list)   rtDeclareVariable(optix::boundCallableProgramId<return_type parameter_list>, function_name,,);
 
#define rtBuffer   __device__ optix::buffer
 
#define rtBufferId   optix::bufferId
 
#define rtTextureSampler   texture
 
#define RT_PROGRAM   __global__
 
#define rtCallableProgramId   optix::callableProgramId
 
#define rtMarkedCallableProgramId   optix::markedCallableProgramId
 
#define rtCallableProgramX   optix::boundCallableProgramId
 

Functions

template<class T >
static __device__ void rtTrace (rtObject topNode, optix::Ray ray, T &prd, RTvisibilitymask mask=RT_VISIBILITY_ALL, RTrayflags flags=RT_RAY_FLAG_NONE)
 
static __device__ bool rtPotentialIntersection (float tmin)
 
static __device__ bool rtReportIntersection (unsigned int material)
 
static __device__ void rtIgnoreIntersection ()
 
static __device__ void rtTerminateRay ()
 
static __device__ void rtIntersectChild (unsigned int index)
 
static __device__ float3 rtTransformPoint (RTtransformkind kind, const float3 &p)
 
static __device__ float3 rtTransformVector (RTtransformkind kind, const float3 &v)
 
static __device__ float3 rtTransformNormal (RTtransformkind kind, const float3 &n)
 
static __device__ void rtGetTransform (RTtransformkind kind, float matrix[16])
 
static __device__ unsigned int rtGetPrimitiveIndex ()
 
static __device__ bool rtIsTriangleHit ()
 
static __device__ bool rtIsTriangleHitBackFace ()
 
static __device__ bool rtIsTriangleHitFrontFace ()
 
static __device__ void rtThrow (unsigned int code)
 
static __device__ unsigned int rtGetExceptionCode ()
 
static __device__ void rtPrintExceptionDetails ()
 
static __device__ float2 rtGetTriangleBarycentrics ()
 
static __device__ void rtPrintf (const char *fmt)
 
template<typename T1 >
static __device__ void rtPrintf (const char *fmt, T1 arg1)
 
template<typename T1 , typename T2 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2)
 
template<typename T1 , typename T2 , typename T3 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12)
 
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 >
static __device__ void rtPrintf (const char *fmt, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13)
 
rtTextureId optix::id
 
rtTextureId float optix::x
 
optix::retVal = tmp
 
rtTextureId float float optix::y
 
rtTextureId float float float optix::z
 
rtTextureId float float int optix::comp
 
rtTextureId float float optix::dPdx
 
rtTextureId float float float optix::dPdy
 
rtTextureId float int optix::layer
 
rtTextureId float float optix::level
 
__device__ uint3 optix::rtTexSize (rtTextureId id)
 
template<typename T >
__device__ T optix::rtTex1D (rtTextureId id, float x)
 
template<>
__device__ float4 optix::rtTex1D (rtTextureId id, float x)
 
template<>
__device__ int4 optix::rtTex1D (rtTextureId id, float x)
 
template<>
__device__ uint4 optix::rtTex1D (rtTextureId id, float x)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex1D,(rtTextureId id, float x),(id, x)) template< typename T > inline __device__ void rtTex1D(T *retVal
 
template<typename T >
__device__ T optix::rtTex1DFetch (rtTextureId id, int x)
 
template<>
__device__ float4 optix::rtTex1DFetch (rtTextureId id, int x)
 
template<>
__device__ int4 optix::rtTex1DFetch (rtTextureId id, int x)
 
template<>
__device__ uint4 optix::rtTex1DFetch (rtTextureId id, int x)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex1DFetch,(rtTextureId id, int x),(id, x)) template< typename T > inline __device__ void rtTex1DFetch(T *retVal
 
template<typename T >
__device__ T optix::rtTex2D (rtTextureId id, float x, float y)
 
template<>
__device__ float4 optix::rtTex2D (rtTextureId id, float x, float y)
 
template<>
__device__ int4 optix::rtTex2D (rtTextureId id, float x, float y)
 
template<>
__device__ uint4 optix::rtTex2D (rtTextureId id, float x, float y)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex2D,(rtTextureId id, float x, float y),(id, x, y)) template< typename T > inline __device__ void rtTex2D(T *retVal
 
template<typename T >
__device__ T optix::rtTex2DFetch (rtTextureId id, int x, int y)
 
template<>
__device__ float4 optix::rtTex2DFetch (rtTextureId id, int x, int y)
 
template<>
__device__ int4 optix::rtTex2DFetch (rtTextureId id, int x, int y)
 
template<>
__device__ uint4 optix::rtTex2DFetch (rtTextureId id, int x, int y)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex2DFetch,(rtTextureId id, int x, int y),(id, x, y)) template< typename T > inline __device__ void rtTex2DFetch(T *retVal
 
template<typename T >
__device__ T optix::rtTex3D (rtTextureId id, float x, float y, float z)
 
template<>
__device__ float4 optix::rtTex3D (rtTextureId id, float x, float y, float z)
 
template<>
__device__ int4 optix::rtTex3D (rtTextureId id, float x, float y, float z)
 
template<>
__device__ uint4 optix::rtTex3D (rtTextureId id, float x, float y, float z)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex3D,(rtTextureId id, float x, float y, float z),(id, x, y, z)) template< typename T > inline __device__ void rtTex3D(T *retVal
 
template<typename T >
__device__ T optix::rtTex3DFetch (rtTextureId id, int x, int y, int z)
 
template<>
__device__ float4 optix::rtTex3DFetch (rtTextureId id, int x, int y, int z)
 
template<>
__device__ int4 optix::rtTex3DFetch (rtTextureId id, int x, int y, int z)
 
template<>
__device__ uint4 optix::rtTex3DFetch (rtTextureId id, int x, int y, int z)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex3DFetch,(rtTextureId id, int x, int y, int z),(id, x, y, z)) template< typename T > inline __device__ void rtTex3DFetch(T *retVal
 
template<typename T >
__device__ T optix::rtTex2DGather (rtTextureId id, float x, float y, int comp=0)
 
template<>
__device__ float4 optix::rtTex2DGather (rtTextureId id, float x, float y, int comp)
 
template<>
__device__ int4 optix::rtTex2DGather (rtTextureId id, float x, float y, int comp)
 
template<>
__device__ uint4 optix::rtTex2DGather (rtTextureId id, float x, float y, int comp)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex2DGather,(rtTextureId id, float x, float y, int comp),(id, x, y, comp)) template< typename T > inline __device__ void rtTex2DGather(T *retVal
 
template<>
__device__ float4 optix::rtTex1DGrad (rtTextureId id, float x, float dPdx, float dPdy)
 
template<>
__device__ int4 optix::rtTex1DGrad (rtTextureId id, float x, float dPdx, float dPdy)
 
template<>
__device__ uint4 optix::rtTex1DGrad (rtTextureId id, float x, float dPdx, float dPdy)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex1DGrad,(rtTextureId id, float x, float dPdx, float dPdy),(id, x, dPdx, dPdy)) template< typename T > inline __device__ void rtTex1DGrad(T *retVal
 
template<typename T >
__device__ T optix::rtTex2DGrad (rtTextureId id, float x, float y, float2 dPdx, float2 dPdy)
 
template<>
__device__ float4 optix::rtTex2DGrad (rtTextureId id, float x, float y, float2 dPdx, float2 dPdy)
 
template<>
__device__ int4 optix::rtTex2DGrad (rtTextureId id, float x, float y, float2 dPdx, float2 dPdy)
 
template<>
__device__ uint4 optix::rtTex2DGrad (rtTextureId id, float x, float y, float2 dPdx, float2 dPdy)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex2DGrad,(rtTextureId id, float x, float y, float2 dPdx, float2 dPdy),(id, x, y, dPdx, dPdy)) template< typename T > inline __device__ void rtTex2DGrad(T *retVal
 
template<typename T >
__device__ T optix::rtTex3DGrad (rtTextureId id, float x, float y, float z, float4 dPdx, float4 dPdy)
 
template<>
__device__ float4 optix::rtTex3DGrad (rtTextureId id, float x, float y, float z, float4 dPdx, float4 dPdy)
 
template<>
__device__ int4 optix::rtTex3DGrad (rtTextureId id, float x, float y, float z, float4 dPdx, float4 dPdy)
 
template<>
__device__ uint4 optix::rtTex3DGrad (rtTextureId id, float x, float y, float z, float4 dPdx, float4 dPdy)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex3DGrad,(rtTextureId id, float x, float y, float z, float4 dPdx, float4 dPdy),(id, x, y, z, dPdx, dPdy)) template< typename T > inline __device__ void rtTex3DGrad(T *retVal
 
template<typename T >
__device__ T optix::rtTex1DLayeredGrad (rtTextureId id, float x, int layer, float dPdx, float dPdy)
 
template<>
__device__ float4 optix::rtTex1DLayeredGrad (rtTextureId id, float x, int layer, float dPdx, float dPdy)
 
template<>
__device__ int4 optix::rtTex1DLayeredGrad (rtTextureId id, float x, int layer, float dPdx, float dPdy)
 
template<>
__device__ uint4 optix::rtTex1DLayeredGrad (rtTextureId id, float x, int layer, float dPdx, float dPdy)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex1DLayeredGrad,(rtTextureId id, float x, int layer, float dPdx, float dPdy),(id, x, layer, dPdx, dPdy)) template< typename T > inline __device__ void rtTex1DLayeredGrad(T *retVal
 
template<typename T >
__device__ T optix::rtTex2DLayeredGrad (rtTextureId id, float x, float y, int layer, float2 dPdx, float2 dPdy)
 
template<>
__device__ float4 optix::rtTex2DLayeredGrad (rtTextureId id, float x, float y, int layer, float2 dPdx, float2 dPdy)
 
template<>
__device__ int4 optix::rtTex2DLayeredGrad (rtTextureId id, float x, float y, int layer, float2 dPdx, float2 dPdy)
 
template<>
__device__ uint4 optix::rtTex2DLayeredGrad (rtTextureId id, float x, float y, int layer, float2 dPdx, float2 dPdy)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex2DLayeredGrad,(rtTextureId id, float x, float y, int layer, float2 dPdx, float2 dPdy),(id, x, y, layer, dPdx, dPdy)) template< typename T > inline __device__ void rtTex2DLayeredGrad(T *retVal
 
template<typename T >
__device__ T optix::rtTex1DLod (rtTextureId id, float x, float level)
 
template<>
__device__ float4 optix::rtTex1DLod (rtTextureId id, float x, float level)
 
template<>
__device__ int4 optix::rtTex1DLod (rtTextureId id, float x, float level)
 
template<>
__device__ uint4 optix::rtTex1DLod (rtTextureId id, float x, float level)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex1DLod,(rtTextureId id, float x, float level),(id, x, level)) template< typename T > inline __device__ void rtTex1DLod(T *retVal
 
template<typename T >
__device__ T optix::rtTex2DLod (rtTextureId id, float x, float y, float level)
 
template<>
__device__ float4 optix::rtTex2DLod (rtTextureId id, float x, float y, float level)
 
template<>
__device__ int4 optix::rtTex2DLod (rtTextureId id, float x, float y, float level)
 
template<>
__device__ uint4 optix::rtTex2DLod (rtTextureId id, float x, float y, float level)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex2DLod,(rtTextureId id, float x, float y, float level),(id, x, y, level)) template< typename T > inline __device__ void rtTex2DLod(T *retVal
 
template<typename T >
__device__ T optix::rtTex3DLod (rtTextureId id, float x, float y, float z, float level)
 
template<>
__device__ float4 optix::rtTex3DLod (rtTextureId id, float x, float y, float z, float level)
 
template<>
__device__ int4 optix::rtTex3DLod (rtTextureId id, float x, float y, float z, float level)
 
template<>
__device__ uint4 optix::rtTex3DLod (rtTextureId id, float x, float y, float z, float level)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex3DLod,(rtTextureId id, float x, float y, float z, float level),(id, x, y, z, level)) template< typename T > inline __device__ void rtTex3DLod(T *retVal
 
template<typename T >
__device__ T optix::rtTex1DLayeredLod (rtTextureId id, float x, int layer, float level)
 
template<>
__device__ float4 optix::rtTex1DLayeredLod (rtTextureId id, float x, int layer, float level)
 
template<>
__device__ int4 optix::rtTex1DLayeredLod (rtTextureId id, float x, int layer, float level)
 
template<>
__device__ uint4 optix::rtTex1DLayeredLod (rtTextureId id, float x, int layer, float level)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex1DLayeredLod,(rtTextureId id, float x, int layer, float level),(id, x, layer, level)) template< typename T > inline __device__ void rtTex1DLayeredLod(T *retVal
 
template<typename T >
__device__ T optix::rtTex2DLayeredLod (rtTextureId id, float x, float y, int layer, float level)
 
template<>
__device__ float4 optix::rtTex2DLayeredLod (rtTextureId id, float x, float y, int layer, float level)
 
template<>
__device__ int4 optix::rtTex2DLayeredLod (rtTextureId id, float x, float y, int layer, float level)
 
template<>
__device__ uint4 optix::rtTex2DLayeredLod (rtTextureId id, float x, float y, int layer, float level)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex2DLayeredLod,(rtTextureId id, float x, float y, int layer, float level),(id, x, y, layer, level)) template< typename T > inline __device__ void rtTex2DLayeredLod(T *retVal
 
template<typename T >
__device__ T optix::rtTex1DLayered (rtTextureId id, float x, int layer)
 
template<>
__device__ float4 optix::rtTex1DLayered (rtTextureId id, float x, int layer)
 
template<>
__device__ int4 optix::rtTex1DLayered (rtTextureId id, float x, int layer)
 
template<>
__device__ uint4 optix::rtTex1DLayered (rtTextureId id, float x, int layer)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex1DLayered,(rtTextureId id, float x, int layer),(id, x, layer)) template< typename T > inline __device__ void rtTex1DLayered(T *retVal
 
template<typename T >
__device__ T optix::rtTex2DLayered (rtTextureId id, float x, float y, int layer)
 
template<>
__device__ float4 optix::rtTex2DLayered (rtTextureId id, float x, float y, int layer)
 
template<>
__device__ int4 optix::rtTex2DLayered (rtTextureId id, float x, float y, int layer)
 
template<>
__device__ uint4 optix::rtTex2DLayered (rtTextureId id, float x, float y, int layer)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTex2DLayered,(rtTextureId id, float x, float y, int layer),(id, x, y, layer)) template< typename T > inline __device__ void rtTex2DLayered(T *retVal
 
template<typename T >
__device__ T optix::rtTexCubemap (rtTextureId id, float x, float y, float z)
 
template<>
__device__ float4 optix::rtTexCubemap (rtTextureId id, float x, float y, float z)
 
template<>
__device__ int4 optix::rtTexCubemap (rtTextureId id, float x, float y, float z)
 
template<>
__device__ uint4 optix::rtTexCubemap (rtTextureId id, float x, float y, float z)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTexCubemap,(rtTextureId id, float x, float y, float z),(id, x, y, z)) template< typename T > inline __device__ void rtTexCubemap(T *retVal
 
template<typename T >
__device__ T optix::rtTexCubemapLayered (rtTextureId id, float x, float y, float z, int layer)
 
template<>
__device__ float4 optix::rtTexCubemapLayered (rtTextureId id, float x, float y, float z, int layer)
 
template<>
__device__ int4 optix::rtTexCubemapLayered (rtTextureId id, float x, float y, float z, int layer)
 
template<>
__device__ uint4 optix::rtTexCubemapLayered (rtTextureId id, float x, float y, float z, int layer)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTexCubemapLayered,(rtTextureId id, float x, float y, float z, int layer),(id, x, y, z, layer)) template< typename T > inline __device__ void rtTexCubemapLayered(T *retVal
 
template<typename T >
__device__ T optix::rtTexCubemapLod (rtTextureId id, float x, float y, float z, float level)
 
template<>
__device__ float4 optix::rtTexCubemapLod (rtTextureId id, float x, float y, float z, float level)
 
template<>
__device__ int4 optix::rtTexCubemapLod (rtTextureId id, float x, float y, float z, float level)
 
template<>
__device__ uint4 optix::rtTexCubemapLod (rtTextureId id, float x, float y, float z, float level)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTexCubemapLod,(rtTextureId id, float x, float y, float z, float level),(id, x, y, z, level)) template< typename T > inline __device__ void rtTexCubemapLod(T *retVal
 
template<typename T >
__device__ T optix::rtTexCubemapLayeredLod (rtTextureId id, float x, float y, float z, int layer, float level)
 
template<>
__device__ float4 optix::rtTexCubemapLayeredLod (rtTextureId id, float x, float y, float z, int layer, float level)
 
template<>
__device__ int4 optix::rtTexCubemapLayeredLod (rtTextureId id, float x, float y, float z, int layer, float level)
 
template<>
__device__ uint4 optix::rtTexCubemapLayeredLod (rtTextureId id, float x, float y, float z, int layer, float level)
 
 optix::_OPTIX_TEX_FUNC_DECLARE_ (rtTexCubemapLayeredLod,(rtTextureId id, float x, float y, float z, int layer, float level),(id, x, y, z, layer, level)) template< typename T > inline __device__ void rtTexCubemapLayeredLod(T *retVal
 

Detailed Description

OptiX public API.

Author
NVIDIA Corporation OptiX public API Reference - Host/Device side

Macro Definition Documentation

#define RT_PROGRAM   __global__

Define an OptiX program.

Description

RT_PROGRAM defines a program program_name with the specified arguments and return value. This function can be bound to a specific program object using rtProgramCreateFromPTXString or rtProgramCreateFromPTXFile, which will subsequently get bound to different programmable binding points.

All programs should have a "void" return type. Bounding box programs will have an argument for the primitive index and the bounding box reference return value (type nvrt::AAbb&). Intersection programs will have a single int primitiveIndex argument. All other programs take zero arguments.

History

RT_PROGRAM was introduced in OptiX 1.0.

See also RT_PROGRAM rtProgramCreateFromPTXFile rtProgramCreateFromPTXString

#define rtBuffer   __device__ optix::buffer

Declare a reference to a buffer object.

Description

rtBuffer<Type, Dim> name;

rtBuffer declares a buffer of type Type and dimensionality Dim. Dim must be between 1 and 4 inclusive and defaults to 1 if not specified. The resulting object provides access to buffer data through the [] indexing operator, where the index is either unsigned int, uint2, uint3, or uint4 for 1, 2, 3 or 4-dimensional buffers (respectively). This operator can be used to read from or write to the resulting buffer at the specified index.

The named buffer obeys the runtime name lookup semantics as described in rtDeclareVariable. A compile error will result if the named buffer is not bound to a buffer object, or is bound to a buffer object of the incorrect type or dimension. The behavior of writing to a read-only buffer is undefined. Reading from a write-only buffer is well defined only if a value has been written previously by the same thread.

This declaration must appear at the file scope (not within a function), and will be visible to all RT_PROGRAM instances within the same compilation unit.

An annotation may be associated with the buffer variable by using the rtDeclareAnnotation macro.

History

rtBuffer was introduced in OptiX 1.0.

See also rtDeclareAnnotation, rtDeclareVariable, rtBufferCreate, rtTextureSampler, rtVariableSetObject rtBufferId

#define rtBufferId   optix::bufferId

A class that wraps buffer access functionality when using a buffer id.

Description

The rtBufferId provides an interface similar to rtBuffer when using a buffer id obtained through rtBufferGetId. Unlike rtBuffer, this class can be passed to functions or stored in other data structures such as the ray payload. It should be noted, however, doing so can limit the extent that OptiX can optimize the generated code.

There is also a version of rtBufferId that can be used by the host code, so that types can exist in both host and device code. See the documentation for rtBufferId found in the optix C++ API header.

History

rtBufferId was introduced in OptiX 3.5.

See also

rtBuffer rtBufferGetId

#define rtCallableProgram (   return_type,
  function_name,
  parameter_list 
)    rtDeclareVariable(optix::boundCallableProgramId<return_type parameter_list>, function_name,,);

Callable Program Declaration.

Description

rtCallableProgram declares callable program name, which will appear to be a callable function with the specified return type and list of arguments. This callable program must be matched against a variable declared on the API object using rtVariableSetObject.

Unless compatibility with SM_10 is needed, new code should #define RT_USE_TEMPLATED_RTCALLABLEPROGRAM and rely on the new templated version of rtCallableProgram.

Example(s):

rtCallableProgram(float3, modColor, (float3, float));
// With RT_USE_TEMPLATED_RTCALLABLEPROGRAM defined
rtDeclareVariable(rtCallableProgram<float3(float3, float)>, modColor);
Parameters
[in]return_typeReturn type of the callable program
[in]function_nameName of the callable program
[in]parameter_listParameter_List of the callable program

History

rtCallableProgram was introduced in OptiX 3.0.

See also rtDeclareVariable rtCallableProgramId rtCallableProgramX

#define rtCallableProgramId   optix::callableProgramId

Callable Program ID Declaration.

Description

rtCallableProgramId declares callable program name, which will appear to be a callable function with the specified return type and list of arguments. This callable program must be matched against a variable declared on the API object of type int.

Example(s):

rtDeclareVariable(rtCallableProgramId<float3(float3, float)>, modColor);
rtBuffer<rtCallableProgramId<float3(float3, float)>, 1> modColors;

History

rtCallableProgramId was introduced in OptiX 3.6.

See also rtCallableProgram rtCallableProgramX rtDeclareVariable rtMarkedCallableProgramId

#define rtCallableProgramX   optix::boundCallableProgramId

Callable Program X Declaration.

Description

rtCallableProgramX declares callable program name, which will appear to be a callable function with the specified return type and list of arguments. This callable program must be matched against a variable declared on the API object using rtVariableSetObject.

Unless compatibility with SM_10 is needed, new code should #define RT_USE_TEMPLATED_RTCALLABLEPROGRAM and rely on the new templated version of rtCallableProgram instead of directly using rtCallableProgramX.

Example(s):

rtDeclareVariable(rtCallableProgramX<float3(float3, float)>, modColor);
// With RT_USE_TEMPLATED_RTCALLABLEPROGRAM defined
rtDeclareVariable(rtCallableProgram<float3(float3, float)>, modColor);

History

rtCallableProgramX was introduced in OptiX 3.6.

See also rtCallableProgram rtCallableProgramId rtDeclareVariable

#define rtDeclareAnnotation (   variable,
  annotation 
)
Value:
namespace rti_internal_annotation { \
__device__ char variable[] = #annotation; \
}

Annotation declaration.

Description

rtDeclareAnnotation sets the annotation annotation of the given variable name. Typically annotations are declared using an argument to rtDeclareVariable, but variables of type rtBuffer and rtTextureSampler are declared using templates, so separate annotation attachment is required.

OptiX does not attempt to interpret the annotation in any way. It is considered metadata for the application to query and interpret in its own way.

Valid annotations

The macro rtDeclareAnnotation uses the C pre-processor's "stringification" feature to turn the literal text of the annotation argument into a string constant. The pre-processor will backslash-escape quotes and backslashes within the text of the annotation. Leading and trailing whitespace will be ignored, and sequences of whitespace in the middle of the text is converted to a single space character in the result. The only restriction the C-PP places on the text is that it may not contain a comma character unless it is either quoted or contained within parens: "," or (,).

Example(s):

rtDeclareAnnotation( tex, this is a test );
annotation = "this is a test"
rtDeclareAnnotation( tex, "this is a test" );
annotation = "\"this is a test\""
rtDeclareAnnotation( tex, float3 a = {1, 2, 3} );
--> Compile Error, no unquoted commas may be present in the annotation
rtDeclareAnnotation( tex, "float3 a = {1, 2, 3}" );
annotation = "\"float3 a = {1, 2, 3}\""
rtDeclareAnnotation( tex, string UIWidget = "slider";
float UIMin = 0.0;
float UIMax = 1.0; );
annotation = "string UIWidget = \"slider\"; float UIMin = 0.0; float UIMax = 1.0;"
Parameters
[in]variableVariable to annotate
[in]annotationAnnotation metadata

History

rtDeclareAnnotation was introduced in OptiX 1.0.

See also rtDeclareVariable, rtVariableGetAnnotation

#define rtDeclareVariable (   type,
  name,
  semantic,
  annotation 
)
Value:
namespace rti_internal_typeinfo { \
__device__ ::rti_internal_typeinfo::rti_typeinfo name = { ::rti_internal_typeinfo::_OPTIX_VARIABLE, sizeof(type)}; \
} \
namespace rti_internal_typename { \
__device__ char name[] = #type; \
} \
namespace rti_internal_typeenum { \
__device__ int name = ::rti_internal_typeinfo::rti_typeenum<type>::m_typeenum; \
} \
namespace rti_internal_semantic { \
__device__ char name[] = #semantic; \
} \
namespace rti_internal_annotation { \
__device__ char name[] = #annotation; \
} \
__device__ type name

Variable declaration.

Description

rtDeclareVariable declares variable name of the specified type. By default, the variable name will be matched against a variable declared on the API object using the lookup hierarchy for the current program. Using the semanticName, this variable can be bound to internal state, to the payload associated with a ray, or to attributes that are communicated between intersection and material programs. An additional optional annotation can be used to associate application-specific metadata with the variable as well.

type may be a primitive type or a user-defined struct (See rtVariableSetUserData). Except for the ray payload and attributes, the declared variable will be read-only. The variable will be visible to all of the cuda functions defined in the current file. The binding of variables to values on API objects is allowed to vary from one instance to another.

Valid semanticNames

  • rtLaunchIndex - The launch invocation index. Type must be one of unsigned int, uint2, uint3, int, int2, int3 and is read-only.
  • rtLaunchDim - The size of each dimension of the launch. The values range from 1 to the launch size in that dimension. Type must be one of unsigned int, uint2, uint3, int, int2, int3 and is read-only.
  • rtCurrentRay - The currently active ray, valid only when a call to rtTrace is active. The vector is not guaranteed to be normalized. Type must be optix::Ray and is read-only.
  • rtIntersectionDistance - The current closest hit distance, valid only when a call to rtTrace is active. Type must be float and is read-only.
  • rtRayPayload - The struct passed into the most recent rtTrace call and is read-write.
  • attribute name - A named attribute passed from the intersection program to a closest-hit or any-hit program. The types must match in both sets of programs. This variable is read-only in the closest-hit or any-hit program and is written in the intersection program.
Parameters
[in]typeType of the variable
[in]nameName of the variable
[in]semanticSemantic name
[in]annotationAnnotation for this variable

History

  • rtDeclareVariable was introduced in OptiX 1.0.
  • rtLaunchDim was introduced in OptiX 2.0.

See also rtDeclareAnnotation, rtVariableGetAnnotation, rtContextDeclareVariable, rtProgramDeclareVariable, rtSelectorDeclareVariable, rtGeometryInstanceDeclareVariable, rtGeometryDeclareVariable, rtMaterialDeclareVariable

#define rtMarkedCallableProgramId   optix::markedCallableProgramId

Marked Callable Program ID Declaration.

Description

rtMarkedCallableProgramId declares callable program name, which will appear to be a callable function with the specified return type and list of arguments. Calls to this callable program can be referenced on the host by the given callSiteName in order to specify the set of callable programs that that may be called at a specific call site. This allows to use bindless callable programs that call rtTrace. Callable programs that call rtTrace need a different call semantic than programs that do not. Specifying the callable programs that may potentially be called at a call site allow OptiX to determine the correct call semantics at each call site. Programs that are declared using rtCallableProgramId may only call trace if they are used in an rtVariable or in a rtBuffer of type . The rtMarkedCallableProgram type is only available on the device and cannot be used in an rtVariable. Objects of type rtCallableProgramId can be transformed into rtMarkedCallableProgramId by using the appropriate constructor.

Example(s):

// Uses named call site marking, potential callees can be set through the host API,
// needed call semantics will determined based on those.
rtMarkedCallableProgramId<float3(float3, float)> modColor(id, "modColorCall");
// callable1 cannot call rtTrace
rtCallableProgramId<void(void)> callable1(id);
// Create marked callable from callable1. Uses named call site marking.
rtMarkedCallableProgramId<void(void)> markedCallable1(callable1, "callSite1");
// Variables of type rtCallableProgramId use automatic detection of the needed call semantics.
rtDeclareVariable(rtCallableProgramId<void(void)>, callable, ,);
callable();
// Buffers of type rtCallableProgramId use automatic detection of the needed call semantics.
rtBuffer<rtCallableProgramId<void(void)>, 1> programBuffer;
programBuffer[0]();
// Overwrite automatic marking with named marking
rtMarkedCallableProgramId<void(void)> marked(programBuffer[0], "callSite2");
// Use information provided through host API to determine call semantics.
marked();

History

rtCallableProgramId was introduced in OptiX 6.0.

See also rtCallableProgram

#define rtTextureSampler   texture

Declares a reference to a texture sampler object.

Description

rtTextureSampler declares a texture of type Type and dimensionality Dim. Dim must be between 1 and 3 inclusive and defaults to 1 if not specified. The resulting object provides access to texture data through the tex1D, tex2D and tex3D functions. These functions can be used only to read the data.

Texture filtering and wrapping modes, specified in ReadMode will be dependent on the state of the texture sampler object created with rtTextureSamplerCreate.

An annotation may be associated with the texture sampler variable by using the rtDeclareAnnotation macro.

History

rtTextureSampler was introduced in OptiX 1.0.

See also rtDeclareAnnotation, rtTextureSamplerCreate

Function Documentation

static __device__ unsigned int rtGetExceptionCode ( )
inlinestatic

Retrieves the type of a caught exception.

Description

rtGetExceptionCode can be called from an exception program to query which type of exception was caught. The returned code is equivalent to one of the RTexception constants passed to rtContextSetExceptionEnabled, RT_EXCEPTION_ALL excluded. For user-defined exceptions, the code is equivalent to the argument passed to rtThrow.

Return values
unsignedint Returned exception code

History

rtGetExceptionCode was introduced in OptiX 1.1.

See also rtContextSetExceptionEnabled, rtContextGetExceptionEnabled, rtContextSetExceptionProgram, rtContextGetExceptionProgram, rtThrow, rtPrintExceptionDetails, RTexception

static __device__ unsigned int rtGetPrimitiveIndex ( )
inlinestatic

Get the index of the closest hit or currently intersecting primitive.

Description

rtGetPrimitiveIndex provides the primitive index similar to what is normally passed to a custom intersection program as an argument. If an primitive-index offset is specified on the geometry (Geometry or GeometryTriangles node), rtGetPrimitiveIndex reports the primitive index of the geometry (range [0;N-1] for N primitives) plus the offset. This behavior is equal to what is passed to an intersection program. The rtGetPrimitiveIndex semantic is available in any hit, closest hit, and intersection programs.

Return values
unsignedint index of the primitive

History

rtGetPrimitiveIndex was introduced in OptiX 6.0.

See also

static __device__ void rtGetTransform ( RTtransformkind  kind,
float  matrix[16] 
)
inlinestatic

Get requested transform.

Description

rtGetTransform returns the requested transform in the return parameter matrix. The type of transform to be retrieved is specified with the kind parameter. kind is an enumerated value that can be either RT_OBJECT_TO_WORLD or RT_WORLD_TO_OBJECT and must be a constant literal. During traversal, intersection and any-hit programs, the current ray will be located in object space. During ray generation, closest-hit and miss programs, the current ray will be located in world space.

There may be significant performance overhead associated with a call to rtGetTransform compared to a call to rtTransformPoint, rtTransformVector, or rtTransformNormal.

Parameters
[in]kindThe type of transform to retrieve
[out]matrixReturn parameter for the requested transform
Return values
voidvoid return value

History

rtGetTransform was introduced in OptiX 1.0.

See also rtTransformCreate, rtTransformPoint, rtTransformVector, rtTransformNormal

static __device__ float2 rtGetTriangleBarycentrics ( )
inlinestatic

Accessor for barycentrics for built in triangle intersection.

Description

rtGetTriangleBarycentrics returns the barycentric coordinates of the intersected triangle. This function is only accessible in a program attached as an attribute program to an RTgeometrytriangles object.

History

See also rtGeometryTrianglesSetAttributeProgram

static __device__ void rtIgnoreIntersection ( )
inlinestatic

Cancels the potential intersection with current ray.

Description

rtIgnoreIntersection causes the current potential intersection to be ignored. This intersection will not become the new closest hit associated with the ray. This function does not return, so values affecting the per-ray data should be applied before calling rtIgnoreIntersection. rtIgnoreIntersection is valid only within an any-hit program.

rtIgnoreIntersection can be used to implement alpha-mapped transparency by ignoring intersections that hit the geometry but are labeled as transparent in a texture. Since any-hit programs are called frequently during intersection, care should be taken to make them as efficient as possible.

Return values
voidvoid return value

History

rtIgnoreIntersection was introduced in OptiX 1.0.

See also rtTerminateRay, rtPotentialIntersection

static __device__ void rtIntersectChild ( unsigned int  index)
inlinestatic

Visit child of selector.

Description

rtIntersectChild will perform intersection on the specified child for the current active ray. This is used in a selector visit program to traverse one of the selector's children. The index specifies which of the children to be visited. As the child is traversed, intersection programs will be called and any-hit programs will be called for positive intersections. When this process is complete, rtIntersectChild will return unless one of the any-hit programs calls rtTerminateRay, in which case this function will never return. Multiple children can be visited during a single selector visit call by calling this function multiple times.

index matches the index used in rtSelectorSetChild on the host. rtIntersectChild is valid only within a selector visit program.

Parameters
[in]indexSpecifies the child to perform intersection on
Return values
voidvoid return value

History

rtIntersectChild was introduced in OptiX 1.0.

See also rtSelectorSetVisitProgram, rtSelectorCreate, rtTerminateRay

static __device__ bool rtIsTriangleHit ( )
inlinestatic

Returns if the hit kind of the closest hit or currently intersecting primitive is a builtin triangle.

Description

rtIsTriangleHit returns true if the intersected primitive is a builtin triangle.

Return values
boolbuiltin triangle hit

History

rtIsTriangleHit was introduced in OptiX 6.0.

See also rtIsTriangleHitBackFace rtIsTriangleHitFrontFace

static __device__ bool rtIsTriangleHitBackFace ( )
inlinestatic

Returns if the back face of a builtin triangle was hit.

Description

rtIsTriangleHitBackFace returns true if the intersected primitive is a builtin triangle and if the back face of that triangle is hit. Returns false otherwise.

Return values
boolbuiltin triangle hit back face

History

rtIsTriangleHitFrontFace was introduced in OptiX 6.0.

See also rtIsTriangleHit rtIsTriangleHitFrontFace

static __device__ bool rtIsTriangleHitFrontFace ( )
inlinestatic

Returns if the front face of a builtin triangle was hit.

Description

rtIsTriangleHitFrontFace returns true if the intersected primitive is a builtin triangle and if the front face of that triangle is hit. Returns false otherwise.

Return values
boolbuiltin triangle hit front face

History

rtIsTriangleHitFrontFace was introduced in OptiX 6.0.

See also rtIsTriangleHit rtIsTriangleHitBackFace

static __device__ bool rtPotentialIntersection ( float  tmin)
inlinestatic

Determine whether a computed intersection is potentially valid.

Description

Reporting an intersection from a geometry program is a two-stage process. If the geometry program computes that the ray intersects the geometry, it will first call rtPotentialIntersection. rtPotentialIntersection will determine whether the reported hit distance is within the valid interval associated with the ray, and return true if the intersection is valid. Subsequently, the geometry program will compute the attributes (normal, texture coordinates, etc.) associated with the intersection before calling rtReportIntersection. When rtReportIntersection is called, the any-hit program associated with the material is called. If the any-hit program does not ignore the intersection then the t value will stand as the new closest intersection.

If rtPotentialIntersection returns true, then rtReportIntersection should always be called after computing the attributes. Furthermore, attributes variables should only be written after a successful return from rtPotentialIntersection.

rtReportIntersection is passed the material index associated with the reported intersection. Objects with a single material should pass an index of zero.

rtReportIntersection and rtPotentialIntersection are valid only within a geometry intersection program.

Parameters
[in]tmint value of the ray to be checked
Return values
boolReturns whether the intersection is valid or not

History

rtPotentialIntersection was introduced in OptiX 1.0.

See also rtGeometrySetIntersectionProgram, rtReportIntersection, rtIgnoreIntersection

static __device__ void rtPrintExceptionDetails ( )
inlinestatic

Print information on a caught exception.

Description

rtGetExceptionCode can be called from an exception program to provide information on the caught exception to the user. The function uses rtPrintf to output details depending on the type of the exception. It is necessary to have printing enabled using rtContextSetPrintEnabled for this function to have any effect.

Return values
voidvoid return type

History

rtPrintExceptionDetails was introduced in OptiX 1.1.

See also rtContextSetExceptionEnabled, rtContextGetExceptionEnabled, rtContextSetExceptionProgram, rtContextGetExceptionProgram, rtContextSetPrintEnabled, rtGetExceptionCode, rtThrow, rtPrintf, RTexception

static __device__ void rtPrintf ( const char *  fmt)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5,
T6  arg6 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5,
T6  arg6,
T7  arg7 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5,
T6  arg6,
T7  arg7,
T8  arg8 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5,
T6  arg6,
T7  arg7,
T8  arg8,
T9  arg9 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5,
T6  arg6,
T7  arg7,
T8  arg8,
T9  arg9,
T10  arg10 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5,
T6  arg6,
T7  arg7,
T8  arg8,
T9  arg9,
T10  arg10,
T11  arg11 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5,
T6  arg6,
T7  arg7,
T8  arg8,
T9  arg9,
T10  arg10,
T11  arg11,
T12  arg12 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 , typename T10 , typename T11 , typename T12 , typename T13 >
static __device__ void rtPrintf ( const char *  fmt,
T1  arg1,
T2  arg2,
T3  arg3,
T4  arg4,
T5  arg5,
T6  arg6,
T7  arg7,
T8  arg8,
T9  arg9,
T10  arg10,
T11  arg11,
T12  arg12,
T13  arg13 
)
inlinestatic

Prints text to the standard output.

Description

rtPrintf is used to output text from within user programs. Arguments are passed as for the standard C printf function, and the same format strings are employed. The only exception is the "%s" format specifier, which will generate an error if used. Text printed using rtPrintf is accumulated in a buffer and printed to the standard output when rtContextLaunch finishes. The buffer size can be configured using rtContextSetPrintBufferSize. Output can optionally be restricted to certain launch indices using rtContextSetPrintLaunchIndex. Printing must be enabled using rtContextSetPrintEnabled, otherwise rtPrintf invocations will be silently ignored.

History

rtPrintf was introduced in OptiX 1.0.

See also rtContextSetPrintEnabled, rtContextGetPrintEnabled, rtContextSetPrintBufferSize, rtContextGetPrintBufferSize, rtContextSetPrintLaunchIndex, rtContextSetPrintLaunchIndex

static __device__ bool rtReportIntersection ( unsigned int  material)
inlinestatic

Report an intersection with the current object and the specified material.

Description

rtReportIntersection reports an intersection of the current ray with the current object, and specifies the material associated with the intersection. rtReportIntersection should only be used in conjunction with rtPotentialIntersection as described in rtPotentialIntersection.

Parameters
[in]materialMaterial associated with the intersection
Return values
boolreturn value, this is set to false if the intersection is, for some reason, ignored History

rtReportIntersection was introduced in OptiX 1.0.

See also rtPotentialIntersection, rtIgnoreIntersection

static __device__ void rtTerminateRay ( )
inlinestatic

Terminate traversal associated with the current ray.

Description

rtTerminateRay causes the traversal associated with the current ray to immediately terminate. After termination, the closest-hit program associated with the ray will be called. This function does not return, so values affecting the per-ray data should be applied before calling rtTerminateRay. rtTerminateRay is valid only within an any-hit program. The value of rtIntersectionDistance is undefined when rtTerminateRay is used.

Return values
voidvoid return value

History

rtTerminateRay was introduced in OptiX 1.0.

See also rtIgnoreIntersection, rtPotentialIntersection

static __device__ void rtThrow ( unsigned int  code)
inlinestatic

Throw a user exception.

Description

rtThrow is used to trigger user defined exceptions which behave like built-in exceptions. That is, upon invocation, ray processing for the current launch index is immediately aborted and the corresponding exception program is executed. rtThrow does not return.

The code passed as argument must be within the range reserved for user exceptions, which starts at RT_EXCEPTION_USER (0x400) and ends at RT_EXCEPTION_USER_MAX (0xFFFF). The code can be queried within the exception program using rtGetExceptionCode.

rtThrow may be called from within any program type except exception programs. Calls to rtThrow will be silently ignored unless user exceptions are enabled using rtContextSetExceptionEnabled.

History

rtThrow was introduced in OptiX 1.1.

See also rtContextSetExceptionEnabled, rtContextGetExceptionEnabled, rtContextSetExceptionProgram, rtContextGetExceptionProgram, rtGetExceptionCode, rtPrintExceptionDetails, RTexception

template<class T >
static __device__ void rtTrace ( rtObject  topNode,
optix::Ray  ray,
T &  prd,
RTvisibilitymask  mask = RT_VISIBILITY_ALL,
RTrayflags  flags = RT_RAY_FLAG_NONE 
)
inlinestatic

Traces a ray.

Description

rtTrace traces ray against object topNode. A reference to prd, the per-ray data, will be passed to all of the closest-hit and any-hit programs that are executed during this invocation of trace. topNode must refer to an OptiX object of type RTgroup, RTselector, RTgeometrygroup or RTtransform.

The optional time argument sets the time of the ray for motion-aware traversal and shading. The ray time is available in user programs as the rtCurrentTime semantic variable. If time is omitted, then the ray inherits the time of the parent ray that triggered the current program. In a ray generation program where there is no parent ray, the time defaults to 0.0.

The optional visibility mask controls intersection against user-configurable groups of objects. Visibility masks of groups and geometries are compared against this mask. Intersections are computed if at least one bit is present in both sets, i.e. if

(group_mask & ray_mask) != 0

. Note that visibility is currently limited to eight groups, only the lower eight bits of mask will be taken into account.

Parameters
[in]topNodeTop node object where to start the traversal
[in]rayRay to be traced
[in]timeTime value for the ray
[in]prdPer-ray custom data
[in]maskVisibility mask as described above
[in]flagsRay flags
Return values
voidvoid return value

History

  • rtTrace was introduced in OptiX 1.0.
  • time was introduced in OptiX 5.0.
  • mask and flags were introduced in OptiX 6.0.

See also rtObject rtCurrentTime Ray RTrayflags

static __device__ float3 rtTransformNormal ( RTtransformkind  kind,
const float3 &  n 
)
inlinestatic

Apply the current transformation to a normal.

Description

rtTransformNormal transforms n as a normal using the current active transformation stack (the inverse transpose). During traversal, intersection and any-hit programs, the current ray will be located in object space. During ray generation, closest-hit and miss programs, the current ray will be located in world space. This function can be used to transform values between object and world space.

kind is an enumerated value that can be either RT_OBJECT_TO_WORLD or RT_WORLD_TO_OBJECT and must be a constant literal. For ray generation and miss programs, the transform will always be the identity transform. For traversal, intersection, any-hit and closest-hit programs, the transform will be dependent on the set of active transform nodes for the current state.

Parameters
[in]kindType of the transform
[in]nNormal to transform
Return values
float3Transformed normal

History

rtTransformNormal was introduced in OptiX 1.0.

See also rtTransformCreate, rtTransformPoint, rtTransformVector

static __device__ float3 rtTransformPoint ( RTtransformkind  kind,
const float3 &  p 
)
inlinestatic

Apply the current transformation to a point.

Description

rtTransformPoint transforms p as a point using the current active transformation stack. During traversal, intersection and any-hit programs, the current ray will be located in object space. During ray generation, closest-hit and miss programs, the current ray will be located in world space. This function can be used to transform the ray origin and other points between object and world space.

kind is an enumerated value that can be either RT_OBJECT_TO_WORLD or RT_WORLD_TO_OBJECT and must be a constant literal. For ray generation and miss programs, the transform will always be the identity transform. For traversal, intersection, any-hit and closest-hit programs, the transform will be dependent on the set of active transform nodes for the current state.

Parameters
[in]kindType of the transform
[in]pPoint to transform
Return values
float3Transformed point

History

rtTransformPoint was introduced in OptiX 1.0.

See also rtTransformCreate, rtTransformVector, rtTransformNormal

static __device__ float3 rtTransformVector ( RTtransformkind  kind,
const float3 &  v 
)
inlinestatic

Apply the current transformation to a vector.

Description

rtTransformVector transforms v as a vector using the current active transformation stack. During traversal, intersection and any-hit programs, the current ray will be located in object space. During ray generation, closest-hit and miss programs, the current ray will be located in world space. This function can be used to transform the ray direction and other vectors between object and world space.

kind is an enumerated value that can be either RT_OBJECT_TO_WORLD or RT_WORLD_TO_OBJECT and must be a constant literal. For ray generation and miss programs, the transform will always be the identity transform. For traversal, intersection, any-hit and closest-hit programs, the transform will be dependent on the set of active transform nodes for the current state.

Parameters
[in]kindType of the transform
[in]vVector to transform
Return values
float3Transformed vector

History

rtTransformVector was introduced in OptiX 1.0.

See also rtTransformCreate, rtTransformPoint, rtTransformNormal