title: rtcForwardIntersect4(4embree4)

text:
# rtcForwardIntersect4(4embree4)

### NAME

```
rtcForwardIntersect4/8/16/Ex - forwards a ray packet to new scene

  from user geometry callback

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcForwardIntersect4(

  void int* valid,

  const struct RTCIntersectFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay4* ray,

  unsigned int instID
);
void rtcForwardIntersect8(

  void int* valid,

  const struct RTCIntersectFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay8* ray,

  unsigned int instID
);
void rtcForwardIntersect16(

  void int* valid,

  const struct RTCIntersectFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay16* ray,

  unsigned int instID,

  unsigned int instPrimID
);
void rtcForwardIntersect4Ex(

  void int* valid,

  const struct RTCIntersectFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay4* ray,

  unsigned int instID,

  unsigned int instPrimID
);
void rtcForwardIntersect8Ex(

  void int* valid,

  const struct RTCIntersectFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay8* ray,

  unsigned int instID,

  unsigned int instPrimID
);
void rtcForwardIntersect16Ex(

  void int* valid,

  const struct RTCIntersectFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay16* ray,

  unsigned int instID,

  unsigned int instPrimID
);

```

### DESCRIPTION
The rtcForwardIntersect4/8/16 and rtcForwardIntersect4/8/16Ex functions forward the traversal of a transformed ray packet (ray argument) into a scene (scene argument) from a user geometry callback. The function can only get invoked from a user geometry callback for a ray traversal initiated with the rtcIntersect4/8/16 function. The callback arguments structure of the callback invokation has to get passed to the ray forwarding (args argument). The user geometry callback should instantly terminate after invoking the rtcForwardIntersect4/8/16/Ex function.

Only the ray origin and ray direction members of the ray argument are used for forwarding, all additional ray properties are inherited from the initial ray traversal invokation of rtcIntersect4/8/16.

The implementation of the rtcForwardIntersect4/8/16 function recursively continues the ray traversal into the specified scene and pushes the provided instance ID (instID argument) to the instance ID stack. Hit information is updated into the ray hit structure passed to the original rtcIntersect4/8/16 invokation.

This function can get used to implement user defined instancing using user geometries, e.g. by transforming the ray in a special way, and/or selecting between different scenes to instantiate.

For user defined instance arrays, the rtcForwardIntersect4/8/16Ex variant has an additional instPrimID argument which is pushed to the instance primitive ID stack. Instance primitive IDs identify which instance of an instance array was hit.

When using Embree on the CPU it is possible to recursively invoke rtcIntersect4/8/16 directly from a user geometry callback. However, when SYCL is used, recursively tracing rays is not directly supported, and the rtcForwardIntersect4/8/16 function must be used.

For rtcForwardIntersect4 the ray packet must be aligned to 16 bytes, for rtcForwardIntersect8 the alignment must be 32 bytes, and for rtcForwardIntersect16 the alignment must be 64 bytes.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcIntersect4/8/16]


package: embree-devel

title: rtcForwardOccluded1(4embree4)

text:
# rtcForwardOccluded1(4embree4)

### NAME

```
rtcForwardOccluded1/Ex - forwards a single ray to new scene

  from user geometry callback

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcForwardOccluded1(

  const struct RTCOccludedFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay* ray,

  unsigned int instID
);
void rtcForwardOccluded1(

  const struct RTCOccludedFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay* ray,

  unsigned int instID,

  unsigned int instPrimID
);

```

### DESCRIPTION
The rtcForwardOccluded1 and rtcForwardOccluded1Ex functions forward the traversal of a transformed ray (ray argument) into a scene (scene argument) from a user geometry callback. The function can only get invoked from a user geometry callback for a ray traversal initiated with the rtcOccluded1 function. The callback arguments structure of the callback invokation has to get passed to the ray forwarding (args argument). The user geometry callback should instantly terminate after invoking the rtcForwardOccluded1/Ex function.

Only the ray origin and ray direction members of the ray argument are used for forwarding, all additional ray properties are inherited from the initial ray traversal invokation of rtcOccluded1.

The implementation of the rtcForwardOccluded1 function recursively continues the ray traversal into the specified scene and pushes the provided instance ID (instID argument) to the instance ID stack. Hit information is updated into the ray structure passed to the original rtcOccluded1 invokation.

This function can get used to implement user defined instancing using user geometries, e.g. by transforming the ray in a special way, and/or selecting between different scenes to instantiate.

For user defined instance arrays, the rtcForwardIntersect1Ex variant has an additional instPrimID argument which is pushed to the instance primitive ID stack. Instance primitive IDs identify which instance of an instance array was hit.

When using Embree on the CPU it is possible to recursively invoke rtcOccluded1 directly from a user geometry callback. However, when SYCL is used, recursively tracing rays is not directly supported, and the rtcForwardOccluded1/Ex function must be used.

The ray structure must be aligned to 16 bytes.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcOccluded1], [RTCRay]


title: rtcForwardOccluded4(4embree4)

text:
# rtcForwardOccluded4(4embree4)

### NAME

```
rtcForwardOccluded4/8/16/Ex - forwards a ray packet to new scene

  from user geometry callback

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcForwardOccluded4(

  void int* valid,

  const struct RTCOccludedFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay4* ray,

  unsigned int instID
);
void rtcForwardOccluded8(

  void int* valid,

  const struct RTCOccludedFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay8* ray,

  unsigned int instID
);
void rtcForwardOccluded16(

  void int* valid,

  const struct RTCOccludedFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay16* ray,

  unsigned int instID
);
void rtcForwardOccluded4Ex(

  void int* valid,

  const struct RTCOccludedFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay4* ray,

  unsigned int instID,

  unsigned int instPrimID
);
void rtcForwardOccluded8Ex(

  void int* valid,

  const struct RTCOccludedFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay8* ray,

  unsigned int instID,

  unsigned int instPrimID
);
void rtcForwardOccluded16Ex(

  void int* valid,

  const struct RTCOccludedFunctionNArguments* args,

  RTCScene scene,

  struct RTCRay16* ray,

  unsigned int instID,

  unsigned int instPrimID
);

```

### DESCRIPTION
The rtcForwardOccluded4/8/16 and rtcForwardOccluded4/8/16Ex functions forward the traversal of a transformed ray packet (ray argument) into a scene (scene argument) from a user geometry callback. The function can only get invoked from a user geometry callback for a ray traversal initiated with the rtcOccluded4/8/16 function. The callback arguments structure of the callback invokation has to get passed to the ray forwarding (args argument). The user geometry callback should instantly terminate after invoking the rtcForwardOccluded4/8/16/Ex function.

Only the ray origin and ray direction members of the ray argument are used for forwarding, all additional ray properties are inherited from the initial ray traversal invokation of rtcOccluded4/8/16.

The implementation of the rtcForwardOccluded4/8/16 function recursively continues the ray traversal into the specified scene and pushes the provided instance ID (instID argument) to the instance ID stack. Hit information is updated into the ray structure passed to the original rtcOccluded4/8/16 invokation.

This function can get used to implement user defined instancing using user geometries, e.g. by transforming the ray in a special way, and/or selecting between different scenes to instantiate.

For user defined instance arrays, the rtcForwardIntersect4/8/16Ex variant has an additional instPrimID argument which is pushed to the instance primitive ID stack. Instance primitive IDs identify which instance of an instance array was hit.

When using Embree on the CPU it is possible to recursively invoke rtcOccluded4/8/16 directly from a user geometry callback. However, when SYCL is used, recursively tracing rays is not directly supported, and the rtcForwardOccluded4/8/16 function must be used.

For rtcForwardOccluded4 the ray packet must be aligned to 16 bytes, for rtcForwardOccluded8 the alignment must be 32 bytes, and for rtcForwardOccluded16 the alignment must be 64 bytes.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcOccluded4/8/16]


rtcGetBufferData

title: rtcGetBufferData(4embree4)

text:
# rtcGetBufferData(4embree4)

### NAME

```
rtcGetBufferData - gets a pointer to the buffer data

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void* rtcGetBufferData(RTCBuffer buffer);

```

### DESCRIPTION
The rtcGetBufferData function returns a pointer to the buffer data of the specified buffer object (buffer argument).

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewBuffer]


rtcGetDeviceError

title: rtcGetDeviceError(4embree4)

text:
# rtcGetDeviceError(4embree4)

### NAME

```
rtcGetDeviceError - returns the error code of the device

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCError rtcGetDeviceError(RTCDevice device);

```

### DESCRIPTION
Each thread has its own error code per device. If an error occurs when calling an API function, this error code is set to the occurred error if it stores no previous error. The rtcGetDeviceError function reads and returns the currently stored error and clears the error code. This assures that the returned error code is always the first error occurred since the last invocation of rtcGetDeviceError.

Possible error codes returned by rtcGetDeviceError are:

•

RTC_ERROR_NONE: No error occurred.

•

RTC_ERROR_UNKNOWN: An unknown error has occurred.

•

RTC_ERROR_INVALID_ARGUMENT: An invalid argument was specified.

•

RTC_ERROR_INVALID_OPERATION: The operation is not allowed for the specified object.

•

RTC_ERROR_OUT_OF_MEMORY: There is not enough memory left to complete the operation.

•

RTC_ERROR_UNSUPPORTED_CPU: The CPU is not supported as it does not support the lowest ISA Embree is compiled for.

•

RTC_ERROR_CANCELLED: The operation got canceled by a memory monitor callback or progress monitor callback function.

When the device construction fails, rtcNewDevice returns NULL as device. To detect the error code of a such a failed device construction, pass NULL as device to the rtcGetDeviceError function. For all other invocations of rtcGetDeviceError, a proper device pointer must be specified.

### EXIT STATUS
Returns the error code for the device.

### SEE ALSO
[rtcSetDeviceErrorFunction]


rtcGetDeviceProperty

title: rtcGetDeviceProperty(4embree4)

text:
# rtcGetDeviceProperty(4embree4)

### NAME

```
rtcGetDeviceProperty - queries properties of the device

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
ssize_t rtcGetDeviceProperty(

  RTCDevice device,

  enum RTCDeviceProperty prop
);

```

### DESCRIPTION
The rtcGetDeviceProperty function can be used to query properties (prop argument) of a device object (device argument). The returned property is an integer of type ssize_t.

Possible properties to query are:

•

RTC_DEVICE_PROPERTY_VERSION: Queries the combined version number (MAJOR.MINOR.PATCH) with two decimal digits per component. E.g. for Embree 2.8.3 the integer 208003 is returned.

•

RTC_DEVICE_PROPERTY_VERSION_MAJOR: Queries the major version number of Embree.

•

RTC_DEVICE_PROPERTY_VERSION_MINOR: Queries the minor version number of Embree.

•

RTC_DEVICE_PROPERTY_VERSION_PATCH: Queries the patch version number of Embree.

•

RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED: Queries whether the rtcIntersect4 and rtcOccluded4 functions preserve packet size and ray order when invoking callback functions. This is only the case if Embree is compiled with EMBREE_RAY_PACKETS and SSE2 (or SSE4.2) enabled, and if the machine it is running on supports SSE2 (or SSE4.2).

•

RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED: Queries whether the rtcIntersect8 and rtcOccluded8 functions preserve packet size and ray order when invoking callback functions. This is only the case if Embree is compiled with EMBREE_RAY_PACKETS and AVX (or AVX2) enabled, and if the machine it is running on supports AVX (or AVX2).

•

RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED: Queries whether the rtcIntersect16 and rtcOccluded16 functions preserve packet size and ray order when invoking callback functions. This is only the case if Embree is compiled with EMBREE_RAY_PACKETS and AVX512 enabled, and if the machine it is running on supports AVX512.

•

RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED: Queries whether ray masks are supported. This is only the case if Embree is compiled with EMBREE_RAY_MASK enabled.

•

RTC_DEVICE_PROPERTY_BACKFACE_CULLING_ENABLED: Queries whether back face culling is enabled. This is only the case if Embree is compiled with EMBREE_BACKFACE_CULLING enabled.

•

RTC_DEVICE_PROPERTY_BACKFACE_CULLING_CURVES_ENABLED: Queries whether back face culling for curves is enabled. This is only the case if Embree is compiled with EMBREE_BACKFACE_CULLING_CURVES enabled.

•

RTC_DEVICE_PROPERTY_BACKFACE_CULLING_SPHERES_ENABLED: Queries whether back face culling for spheres is enabled. This is only the case if Embree is compiled with EMBREE_BACKFACE_CULLING_SPHERES enabled.

•

RTC_DEVICE_PROPERTY_COMPACT_POLYS_ENABLED: Queries whether compact polys is enabled. This is only the case if Embree is compiled with EMBREE_COMPACT_POLYS enabled.

•

RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED: Queries whether filter functions are supported, which is the case if Embree is compiled with EMBREE_FILTER_FUNCTION enabled.

•

RTC_DEVICE_PROPERTY_IGNORE_INVALID_RAYS_ENABLED: Queries whether invalid rays are ignored, which is the case if Embree is compiled with EMBREE_IGNORE_INVALID_RAYS enabled.

•

RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED: Queries whether triangles are supported, which is the case if Embree is compiled with EMBREE_GEOMETRY_TRIANGLE enabled.

•

RTC_DEVICE_PROPERTY_QUAD_GEOMETRY_SUPPORTED: Queries whether quads are supported, which is the case if Embree is compiled with EMBREE_GEOMETRY_QUAD enabled.

•

RTC_DEVICE_PROPERTY_SUBDIVISION_GEOMETRY_SUPPORTED: Queries whether subdivision meshes are supported, which is the case if Embree is compiled with EMBREE_GEOMETRY_SUBDIVISION enabled.

•

RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED: Queries whether curves are supported, which is the case if Embree is compiled with EMBREE_GEOMETRY_CURVE enabled.

•

RTC_DEVICE_PROPERTY_POINT_GEOMETRY_SUPPORTED: Queries whether points are supported, which is the case if Embree is compiled with EMBREE_GEOMETRY_POINT enabled.

•

RTC_DEVICE_PROPERTY_USER_GEOMETRY_SUPPORTED: Queries whether user geometries are supported, which is the case if Embree is compiled with EMBREE_GEOMETRY_USER enabled.

•

RTC_DEVICE_PROPERTY_TASKING_SYSTEM: Queries the tasking system Embree is compiled with. Possible return values are:

0.

internal tasking system

1.

Intel Threading Building Blocks (TBB)

2.

Parallel Patterns Library (PPL)

•

RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED: Queries whether rtcJoinCommitScene is supported. This is not the case when Embree is compiled with PPL or older versions of TBB.

•

RTC_DEVICE_PROPERTY_PARALLEL_COMMIT_SUPPORTED: Queries whether rtcCommitScene can get invoked from multiple TBB worker threads concurrently. This feature is only supported starting with TBB 2019 Update 9.

### EXIT STATUS
On success returns the value of the queried property. For properties returning a boolean value, the return value 0 denotes false and 1 denotes true.

On failure zero is returned and an error code is set that can be queried using rtcGetDeviceError.


rtcGetGeometry

title: rtcGetGeometry(4embree4)

text:
# rtcGetGeometry(4embree4)

### NAME

```
rtcGetGeometry - returns the geometry bound to

  the specified geometry ID

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCGeometry rtcGetGeometry(RTCScene scene, unsigned int geomID);

```

### DESCRIPTION
The rtcGetGeometry function returns the geometry that is bound to the specified geometry ID (geomID argument) for the specified scene (scene argument). This function just looks up the handle and does not increment the reference count. If you want to get ownership of the handle, you need to additionally call rtcRetainGeometry.

This function is not thread safe and thus can be used during rendering. However, it is generally recommended to store the geometry handle inside the application’s geometry representation and look up the geometry handle from that representation directly.

If you need a thread safe version of this function please use [rtcGetGeometryThreadSafe].

### EXIT STATUS
On failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcAttachGeometry], [rtcAttachGeometryByID], [rtcGetGeometryThreadSafe]


rtcGetGeometryBufferData

title: rtcGetGeometryBufferData(4embree4)

text:
# rtcGetGeometryBufferData(4embree4)

### NAME

```
rtcGetGeometryBufferData - gets pointer to

  the first buffer view element

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void* rtcGetGeometryBufferData(

  RTCGeometry geometry,

  enum RTCBufferType type,

  unsigned int slot
);

```

### DESCRIPTION
The rtcGetGeometryBufferData function returns a pointer to the first element of the buffer view attached to the specified buffer type and slot (type and slot argument) of the geometry (geometry argument).

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryBuffer], [rtcSetSharedGeometryBuffer], [rtcSetNewGeometryBuffer]


rtcGetGeometryFace

title: rtcGetGeometryFace(4embree4)

text:
# rtcGetGeometryFace(4embree4)

### NAME

```
rtcGetGeometryFace - returns the face of some half edge

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
unsigned int rtcGetGeometryFace(

  RTCGeometry geometry,

  unsigned int edgeID
);

```

### DESCRIPTION
The rtcGetGeometryFace function returns the ID of the face the specified half edge (edgeID argument) belongs to. For instance in the following example the face f1 is returned for edges e4, e5, e6, and e7.

```

```

This function can only be used for subdivision geometries. As all topologies of a subdivision geometry share the same face buffer the function does not depend on the topology ID.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetGeometryFirstHalfEdge], [rtcGetGeometryFace], [rtcGetGeometryOppositeHalfEdge], [rtcGetGeometryNextHalfEdge], [rtcGetGeometryPreviousHalfEdge]


rtcGetGeometryFirstHalfEdge

title: rtcGetGeometryFirstHalfEdge(4embree4)

text:
# rtcGetGeometryFirstHalfEdge(4embree4)

### NAME

```
rtcGetGeometryFirstHalfEdge - returns the first half edge of a face

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
unsigned int rtcGetGeometryFirstHalfEdge(

  RTCGeometry geometry,

  unsigned int faceID
);

```

### DESCRIPTION
The rtcGetGeometryFirstHalfEdge function returns the ID of the first half edge belonging to the specified face (faceID argument). For instance in the following example the first half edge of face f1 is e4.

```

```

This function can only be used for subdivision geometries. As all topologies of a subdivision geometry share the same face buffer the function does not depend on the topology ID.

Here f0 to f7 are 8 quadrilateral faces with 4 vertices each. The edges e0 to e23 of these faces are shown with their orientation. For each face the ID of the edges corresponds to the slots the face occupies in the index array of the geometry. E.g. as the indices of face f1 start at location 4 of the index array, the first edge is edge e4, the next edge e5, etc.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetGeometryFirstHalfEdge], [rtcGetGeometryFace], [rtcGetGeometryOppositeHalfEdge], [rtcGetGeometryNextHalfEdge], [rtcGetGeometryPreviousHalfEdge]


rtcGetGeometryNextHalfEdge

title: rtcGetGeometryNextHalfEdge(4embree4)

text:
# rtcGetGeometryNextHalfEdge(4embree4)

### NAME

```
rtcGetGeometryNextHalfEdge - returns the next half edge

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
unsigned int rtcGetGeometryNextHalfEdge(

  RTCGeometry geometry,

  unsigned int edgeID
);

```

### DESCRIPTION
The rtcGetGeometryNextHalfEdge function returns the ID of the next half edge of the specified half edge (edgeID argument). For instance in the following example the next half edge of e10 is e11.

```

```

This function can only be used for subdivision geometries. As all topologies of a subdivision geometry share the same face buffer the function does not depend on the topology ID.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetGeometryFirstHalfEdge], [rtcGetGeometryFace], [rtcGetGeometryOppositeHalfEdge], [rtcGetGeometryNextHalfEdge], [rtcGetGeometryPreviousHalfEdge]


rtcGetGeometryOppositeHalfEdge

text:
# rtcGetGeometryOppositeHalfEdge(4embree4)

### NAME

```
rtcGetGeometryOppositeHalfEdge - returns the opposite half edge

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
unsigned int rtcGetGeometryOppositeHalfEdge(

  RTCGeometry geometry,

  unsigned int topologyID,

  unsigned int edgeID
);

```

### DESCRIPTION
The rtcGetGeometryOppositeHalfEdge function returns the ID of the opposite half edge of the specified half edge (edgeID argument) in the specified topology (topologyID argument). For instance in the following example the opposite half edge of e6 is e16.

```

```

An opposite half edge does not exist if the specified half edge has either no neighboring face, or more than 2 neighboring faces. In these cases the function just returns the same edge edgeID again.

This function can only be used for subdivision geometries. The function depends on the topology as the topologies of a subdivision geometry have different index buffers assigned.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetGeometryFirstHalfEdge], [rtcGetGeometryFace], [rtcGetGeometryOppositeHalfEdge], [rtcGetGeometryNextHalfEdge], [rtcGetGeometryPreviousHalfEdge]


rtcGetGeometryPreviousHalfEdge

text:
# rtcGetGeometryPreviousHalfEdge(4embree4)

### NAME

```
rtcGetGeometryPreviousHalfEdge - returns the previous half edge

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
unsigned int rtcGetGeometryPreviousHalfEdge(

  RTCGeometry geometry,

  unsigned int edgeID
);

```

### DESCRIPTION
The rtcGetGeometryPreviousHalfEdge function returns the ID of the previous half edge of the specified half edge (edgeID argument). For instance in the following example the previous half edge of e6 is e5.

```

```

This function can only be used for subdivision geometries. As all topologies of a subdivision geometry share the same face buffer the function does not depend on the topology ID.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetGeometryFirstHalfEdge], [rtcGetGeometryFace], [rtcGetGeometryOppositeHalfEdge], [rtcGetGeometryNextHalfEdge], [rtcGetGeometryPreviousHalfEdge]


rtcGetGeometryThreadSafe

title: rtcGetGeometryThreadSafe(4embree4)

text:
# rtcGetGeometryThreadSafe(4embree4)

### NAME

```
rtcGetGeometryThreadSafe - returns the geometry bound to

  the specified geometry ID

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCGeometry rtcGetGeometryThreadSafe(RTCScene scene, unsigned int geomID);

```

### DESCRIPTION
The rtcGetGeometryThreadSafe function returns the geometry that is bound to the specified geometry ID (geomID argument) for the specified scene (scene argument). This function just looks up the handle and does not increment the reference count. If you want to get ownership of the handle, you need to additionally call rtcRetainGeometry.

This function is thread safe and should NOT get used during rendering. If you need a fast non-thread safe version during rendering please use the [rtcGetGeometry] function.

### EXIT STATUS
On failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcAttachGeometry], [rtcAttachGeometryByID], [rtcGetGeometry]


rtcGetGeometryTransform

title: rtcGetGeometryTransform(4embree4)

text:
# rtcGetGeometryTransform(4embree4)

### NAME

```
rtcGetGeometryTransform - returns the interpolated instance

  transformation for the specified time

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcGetGeometryTransform(

  RTCGeometry geometry,

  float time,

  enum RTCFormat format,

  void* xfm
);

```

### DESCRIPTION
The rtcGetGeometryTransform function returns the interpolated local to world transformation (xfm parameter) of an instance geometry (geometry parameter) for a particular time (time parameter in range [0, 1]) in the specified format (format parameter).

Possible formats for the returned matrix are:

•

RTC_FORMAT_FLOAT3X4_ROW_MAJOR: The 3×4 float matrix is laid out in row-major form.

•

RTC_FORMAT_FLOAT3X4_COLUMN_MAJOR: The 3×4 float matrix is laid out in column-major form.

•

RTC_FORMAT_FLOAT4X4_COLUMN_MAJOR: The 3×4 float matrix is laid out in column-major form as a 4×4 homogeneous matrix with last row equal to (0, 0, 0, 1).

This function is supposed to be used during rendering, but only supported on the CPU and not inside SYCL kernels on the GPU. Inside a SYCL kernel the rtcGetGeometryTransformFromScene function has to get used.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_INSTANCE], [rtcSetGeometryTransform], [rtcGetGeometryTransformFromScene]


rtcGetGeometryTransformEx

title: rtcGetGeometryTransformEx(4embree4)

text:
# rtcGetGeometryTransformEx(4embree4)

### NAME

```
rtcGetGeometryTransformEx - returns the interpolated instance
transformation for an instance of an instance array geometry for the
specified time.

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcGetGeometryTransformEx(

  RTCGeometry geometry,

  unsigned int instPrimID,

  float time,

  enum RTCFormat format,

  void* xfm
);

```

### DESCRIPTION
The rtcGetGeometryTransformEx function returns the interpolated local to world transformation (xfm parameter) of the instPrimID-th instance of an instance array geometry (geometry parameter) for a particular time (time parameter in range [0, 1]) in the specified format (format parameter). The function can also be used when geometry refers to a regular instance, but then the instPrimID has to be 0.

Possible formats for the returned matrix are:

•

RTC_FORMAT_FLOAT3X4_ROW_MAJOR: The 3×4 float matrix is laid out in row-major form.

•

RTC_FORMAT_FLOAT3X4_COLUMN_MAJOR: The 3×4 float matrix is laid out in column-major form.

•

RTC_FORMAT_FLOAT4X4_COLUMN_MAJOR: The 3×4 float matrix is laid out in column-major form as a 4×4 homogeneous matrix with last row equal to (0, 0, 0, 1).

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_INSTANCE_ARRAY]


rtcGetGeometryTransformFromScene

text:
# rtcGetGeometryTransformFromScene(4embree4)

### NAME

```
rtcGetGeometryTransformFromScene - returns the interpolated instance

  transformation for the specified time

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcGetGeometryTransformFromScene(

  RTCScene scene,

  unsigned int geomID,

  float time,

  enum RTCFormat format,

  void* xfm
);

```

### DESCRIPTION
The rtcGetGeometryTransformFromScene function returns the interpolated local to world transformation (xfm output parameter) of an instance geometry specified by its geometry ID (geomID parameter) of a scene (scene parameter) for a particular time (time parameter in range [0, 1]) in the specified format (format parameter).

Possible formats for the returned matrix are:

•

RTC_FORMAT_FLOAT3X4_ROW_MAJOR: The 3×4 float matrix is laid out in row-major form.

•

RTC_FORMAT_FLOAT3X4_COLUMN_MAJOR: The 3×4 float matrix is laid out in column-major form.

•

RTC_FORMAT_FLOAT4X4_COLUMN_MAJOR: The 3×4 float matrix is laid out in column-major form as a 4×4 homogeneous matrix with last row equal to (0, 0, 0, 1).

In contrast to the rtcGetGeometryTransform function, the rtcGetGeometryTransformFromScene function can get used during rendering inside a SYCL kernel.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[RTC_GEOMETRY_TYPE_INSTANCE], [rtcSetGeometryTransform], [rtcGetGeometryTransform]


rtcGetGeometryUserData

title: rtcGetGeometryUserData(4embree4)

text:
# rtcGetGeometryUserData(4embree4)

### NAME

```
rtcGetGeometryUserData - returns the user data pointer

  of the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void* rtcGetGeometryUserData(RTCGeometry geometry);

```

### DESCRIPTION
The rtcGetGeometryUserData function queries the user data pointer previously set with rtcSetGeometryUserData. When rtcSetGeometryUserData was not called yet, NULL is returned.

This function is supposed to be used during rendering, but only supported on the CPU and not inside SYCL kernels on the GPU. Inside a SYCL kernel the rtcGetGeometryUserDataFromScene function has to get used.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryUserData], [rtcGetGeometryUserDataFromScene]


rtcGetGeometryUserDataFromScene

text:
# rtcGetGeometryUserDataFromScene(4embree4)

### NAME

```
rtcGetGeometryUserDataFromScene - returns the user data pointer

  of the geometry through the scene object

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void* rtcGetGeometryUserDataFromScene(RTCScene scene, unsigned int geomID);

```

### DESCRIPTION
The rtcGetGeometryUserDataFromScene function queries the user data pointer previously set with rtcSetGeometryUserData from the geometry with index geomID from the specified scene scene. When rtcSetGeometryUserData was not called yet, NULL is returned.

In contrast to the rtcGetGeometryUserData function, the rtcGetGeometryUserDataFromScene function an get used during rendering inside a SYCL kernel.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryUserData], [rtcGetGeometryUserData]


rtcGetSYCLDeviceFunctionPointer

text:
# rtcGetSYCLDeviceFunctionPointer(4embree4)

### NAME

```
rtcGetSYCLDeviceFunctionPointer - obtains a device side

  function pointer for some SYCL function

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
template<auto F>
inline decltype(F) rtcGetSYCLDeviceFunctionPointer(sycl::queue& queue);

```

### DESCRIPTION
This function returns a device side function pointer for some function F. This function F must be defined using the RTC_SYCL_INDIRECTLY_CALLABLE attribute, e.g.:

```
RTC_SYCL_INDIRECTLY_CALLABLE void filter(

  const RTCFilterFunctionNArguments* args) { ... }
RTCFilterFunctionN fptr = rtcGetSYCLDeviceFunctionPointer<filter>(queue);

```

Such a device side function pointers of some filter callbacks can get assigned to a geometry using the rtcSetGeometryIntersectFilterFunction and rtcSetGeometryOccludedFilterFunction API functions.

Further, device side function pointers for user geometry callbacks can be assigned to geometries using the rtcSetGeometryIntersectFunction and rtcSetGeometryOccludedFunction API calls.

These geometry versions of the callback functions are disabled in SYCL by default, and we recommend not using them for performance reasons.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetGeometryIntersectFunction], [rtcSetGeometryOccludedFunction], [rtcSetGeometryIntersectFilterFunction], [rtcSetGeometryOccludedFilterFunction]


rtcGetSceneBounds

title: rtcGetSceneBounds(4embree4)

text:
# rtcGetSceneBounds(4embree4)

### NAME

```
rtcGetSceneBounds - returns the axis-aligned bounding box of the scene

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCORE_ALIGN(16) RTCBounds
{

  float lower_x, lower_y, lower_z, align0;

  float upper_x, upper_y, upper_z, align1;
};
void rtcGetSceneBounds(

  RTCScene scene,

  struct RTCBounds* bounds_o
);

```

### DESCRIPTION
The rtcGetSceneBounds function queries the axis-aligned bounding box of the specified scene (scene argument) and stores that bounding box to the provided destination pointer (bounds_o argument). The stored bounding box consists of lower and upper bounds for the x, y, and z dimensions as specified by the RTCBounds structure.

The provided destination pointer must be aligned to 16 bytes. The function may be invoked only after committing the scene; otherwise the result is undefined.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetSceneLinearBounds], [rtcCommitScene], [rtcJoinCommitScene]


rtcGetSceneDevice

title: rtcGetSceneDevice(4embree4)

text:
# rtcGetSceneDevice(4embree4)

### NAME

```
rtcGetSceneDevice - returns the device the scene got created in

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCDevice rtcGetSceneDevice(RTCScene scene);

```

### DESCRIPTION
This function returns the device object the scene got created in. The returned handle own one additional reference to the device object, thus you should need to call rtcReleaseDevice when the returned handle is no longer required.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcReleaseDevice]


rtcGetSceneFlags

title: rtcGetSceneFlags(4embree4)

text:
# rtcGetSceneFlags(4embree4)

### NAME

```
rtcGetSceneFlags - returns the flags of the scene

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
enum RTCSceneFlags rtcGetSceneFlags(RTCScene scene);

```

### DESCRIPTION
Queries the flags of a scene. This function can be useful when setting individual flags, e.g. to just set the robust mode without changing other flags the following way:

```
RTCSceneFlags flags = rtcGetSceneFlags(scene);
rtcSetSceneFlags(scene, RTC_SCENE_FLAG_ROBUST | flags);

```

### EXIT STATUS
On failure RTC_SCENE_FLAG_NONE is returned and an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcSetSceneFlags]


rtcGetSceneLinearBounds

title: rtcGetSceneLinearBounds(4embree4)

text:
# rtcGetSceneLinearBounds(4embree4)

### NAME

```
rtcGetSceneLinearBounds - returns the linear bounds of the scene

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCORE_ALIGN(16) RTCLinearBounds
{

  RTCBounds bounds0;

  RTCBounds bounds1;
};
void rtcGetSceneLinearBounds(

  RTCScene scene,

  struct RTCLinearBounds* bounds_o
);

```

### DESCRIPTION
The rtcGetSceneLinearBounds function queries the linear bounds of the specified scene (scene argument) and stores them to the provided destination pointer (bounds_o argument). The stored linear bounds consist of bounding boxes for time 0 (bounds0 member) and time 1 (bounds1 member) as specified by the RTCLinearBounds structure. Linearly interpolating these bounds to a specific time t yields bounds for the geometry at that time.

The provided destination pointer must be aligned to 16 bytes. The function may be called only after committing the scene, otherwise the result is undefined.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetSceneBounds], [rtcCommitScene], [rtcJoinCommitScene]


rtcInitIntersectArguments

title: rtcInitIntersectArguments(4embree4)

text:
# rtcInitIntersectArguments(4embree4)

### NAME

```
rtcInitIntersectArguments - initializes the intersect arguments struct

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
enum RTCRayQueryFlags
{

  RTC_RAY_QUERY_FLAG_NONE,

  RTC_RAY_QUERY_FLAG_INCOHERENT,

  RTC_RAY_QUERY_FLAG_COHERENT,

  RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER
};
struct RTCIntersectArguments
{

  enum RTCRayQueryFlags flags;

  enum RTCFeatureFlags feature_mask;

  struct RTCRayQueryContext* context;

  RTCFilterFunctionN filter;

  RTCIntersectFunctionN intersect;
#if RTC_MIN_WIDTH

  float minWidthDistanceFactor;
#endif
};
void rtcInitIntersectArguments(

  struct RTCIntersectArguments* args
);

```

### DESCRIPTION
The rtcInitIntersectArguments function initializes the optional argument struct that can get passed to the rtcIntersect1/4/8/16 functions to default values. The arguments struct needs to get used for more advanced Embree features as described here.

The flags member can get used to enable special traversal mode. Using the RTC_RAY_QUERY_FLAG_INCOHERENT flag uses an optimized traversal algorithm for incoherent rays (default), while RTC_RAY_QUERY_FLAG_COHERENT uses an optimized traversal algorithm for coherent rays (e.g. primary camera rays).

The feature_mask member should get used in SYCL to just enable ray tracing features required to render a given scene. Please see section [RTCFeatureFlags] for a more detailed description.

The context member can get used to pass an optional intersection context. It is guaranteed that the pointer to the context passed to a ray query is directly passed to all callback functions. This way it is possible to attach arbitrary data to the end of the context, such as a per-ray payload. Please note that the ray pointer is not guaranteed to be passed to the callback functions, thus reading additional data from the ray pointer passed to callbacks is not possible. See section [rtcInitRayQueryContext] for more details.

The filter member specifies a filter function to invoke for each encountered hit. The support for the argument filter function must be enabled for a scene by using the RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS scene flag. In case of instancing this feature has to get enabled also for each instantiated scene.

The argument filter function is invoked for each geometry for which it got explicitely enabled using the rtcSetGeometryEnableFilterFunctionFromArguments function. The invokation of the argument filter function can also get enfored for each geometry using the RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER ray query flag. This argument filter function is invoked as a second filter stage after the per-geometry filter function is invoked. Only rays that passed the first filter stage are valid in this second filter stage. Having such a per ray-query filter function can be useful to implement modifications of the behavior of the query, such as collecting all hits or accumulating transparencies.

The intersect member specifies the user geometry callback to get invoked for each user geometry encountered during traversal. The user geometry callback specified this way has preference over the one specified inside the geometry.

The minWidthDistanceFactor value controls the target size of the curve radii when the min-width feature is enabled. Please see the [rtcSetGeometryMaxRadiusScale] function for more details on the min-width feature.

### EXIT STATUS
No error code is set by this function.

### SEE ALSO
[rtcIntersect1], [rtcIntersect4/8/16], [RTCFeatureFlags], [rtcInitRayQueryContext], [RTC_GEOMETRY_TYPE_USER], [rtcSetGeometryMaxRadiusScale]


rtcInitOccludedArguments

title: rtcInitOccludedArguments(4embree4)

text:
# rtcInitOccludedArguments(4embree4)

### NAME

```
rtcInitOccludedArguments - initializes the occluded arguments struct

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
enum RTCRayQueryFlags
{

  RTC_RAY_QUERY_FLAG_NONE,

  RTC_RAY_QUERY_FLAG_INCOHERENT,

  RTC_RAY_QUERY_FLAG_COHERENT,

  RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER
};
struct RTCOccludedArguments
{

  enum RTCRayQueryFlags flags;

  enum RTCFeatureFlags feature_mask;

  struct RTCRayQueryContext* context;

  RTCFilterFunctionN filter;

  RTCOccludedFunctionN intersect;
#if RTC_MIN_WIDTH

  float minWidthDistanceFactor;
#endif
};
void rtcInitOccludedArguments(

  struct RTCOccludedArguments* args
);

```

### DESCRIPTION
The rtcInitOccludedArguments function initializes the optional argument struct that can get passed to the rtcOccluded1/4/8/16 functions to default values. The arguments struct needs to get used for more advanced Embree features as described here.

The flags member can get used to enable special traversal mode. Using the RTC_RAY_QUERY_FLAG_INCOHERENT flag uses an optimized traversal algorithm for incoherent rays (default), while RTC_RAY_QUERY_FLAG_COHERENT uses an optimized traversal algorithm for coherent rays (e.g. primary camera rays).

The feature_mask member should get used in SYCL to just enable ray tracing features required to render a given scene. Please see section [RTCFeatureFlags] for a more detailed description.

The context member can get used to pass an optional intersection context. It is guaranteed that the pointer to the context passed to a ray query is directly passed to all callback functions. This way it is possible to attach arbitrary data to the end of the context, such as a per-ray payload. Please note that the ray pointer is not guaranteed to be passed to the callback functions, thus reading additional data from the ray pointer passed to callbacks is not possible. See section [rtcInitRayQueryContext] for more details.

The filter member specifies a filter function to invoked for each encountered hit. The support for the argument filter function must be enabled for a scene by using the RTC_SCENE_FLAG_FILTER_FUNCTION_IN_ARGUMENTS scene flag. In case of instancing this feature has to get enabled also for each instantiated scene.

The argument filter function is invoked for each geometry for which it got explicitely enabled using the rtcSetGeometryEnableFilterFunctionFromArguments function. The invokation of the argument filter function can also get enfored for each geometry using the RTC_RAY_QUERY_FLAG_INVOKE_ARGUMENT_FILTER ray query flag. This argument filter function is invoked as a second filter stage after the per-geometry filter function is invoked. Only rays that passed the first filter stage are valid in this second filter stage. Having such a per ray-query filter function can be useful to implement modifications of the behavior of the query, such as collecting all hits or accumulating transparencies.

The intersect member specifies the user geometry callback to get invoked for each user geometry encountered during traversal. The user geometry callback specified this way has preference over the one specified inside the geometry.

The minWidthDistanceFactor value controls the target size of the curve radii when the min-width feature is enabled. Please see the [rtcSetGeometryMaxRadiusScale] function for more details on the min-width feature.

### EXIT STATUS
No error code is set by this function.

### SEE ALSO
[rtcOccluded1], [rtcOccluded4/8/16], [RTCFeatureFlags], [rtcInitRayQueryContext], [RTC_GEOMETRY_TYPE_USER], [rtcSetGeometryMaxRadiusScale]


rtcInitPointQueryContext

title: rtcInitPointQueryContext(4embree4)

text:
# rtcInitPointQueryContext(4embree4)

### NAME

```
rtcInitPointQueryContext - initializes the context information (e.g.

  stack of (multilevel-)instance transformations) for point queries

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTC_ALIGN(16) RTCPointQueryContext
{

  // accumulated 4x4 column major matrices from world to instance space.

  float world2inst[RTC_MAX_INSTANCE_LEVEL_COUNT][16];

  // accumulated 4x4 column major matrices from instance to world space.

  float inst2world[RTC_MAX_INSTANCE_LEVEL_COUNT][16];

  // instance ids.

  unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT];

  // number of instances currently on the stack.

  unsigned int instStackSize;
};
void rtcInitPointQueryContext(

  struct RTCPointQueryContext* context
);

```

### DESCRIPTION
A stack (RTCPointQueryContext type) which stores the IDs and instance transformations during a BVH traversal for a point query. The transformations are assumed to be affine transformations (3×3 matrix plus translation) and therefore the last column is ignored (see [RTC_GEOMETRY_TYPE_INSTANCE] for details).

The rtcInitPointContext function initializes the context to default values and should be called for initialization.

The context will be passed as an argument to the point query callback function (see [rtcSetGeometryPointQueryFunction]) and should be used to pass instance information down the instancing chain for user defined instancing (see tutorial [ClosestPoint] for a reference implementation of point queries with user defined instancing).

The context is an necessary argument to [rtcPointQuery] and Embree internally uses the topmost instance transformation of the stack to transform the point query into instance space.

### EXIT STATUS
No error code is set by this function.

### SEE ALSO
[rtcPointQuery], [rtcSetGeometryPointQueryFunction]


rtcInitQuaternionDecomposition

text:
# rtcInitQuaternionDecomposition(4embree4)

### NAME

```
rtcInitQuaternionDecomposition - initializes quaternion decomposition

```

### SYNOPSIS

```
void rtcInitQuaternionDecomposition(

  struct RTCQuaternionDecomposition* qd
);

```

### DESCRIPTION
The rtcInitQuaternionDecomposition function initializes a RTCQuaternionDecomposition structure to represent an identity transformation.

### EXIT STATUS
No error code is set by this function.

### SEE ALSO
[rtcSetGeometryTransformQuaternion], [RTCQuaternionDecomposition]


rtcInitRayQueryContext

title: rtcInitRayQueryContext(4embree4)

text:
# rtcInitRayQueryContext(4embree4)

### NAME

```
rtcInitRayQueryContext - initializes the ray query context

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCRayQueryContext
{

  #if RTC_MAX_INSTANCE_LEVEL_COUNT > 1

    unsigned int instStackSize;

  #endif

  unsigned int instID[RTC_MAX_INSTANCE_LEVEL_COUNT];
};
void rtcInitRayQueryContext(

  struct RTCRayQueryContext* context
);

```

### DESCRIPTION
The rtcInitRayQueryContext function initializes the intersection context to default values and should be called to initialize every ray query context.

It is guaranteed that the pointer to the ray query context (RTCRayQueryContext type) is passed to the registered callback functions. This way it is possible to attach arbitrary data to the end of the ray query context, such as a per-ray payload.

Inside the user geometry callback the ray query context can get used to access the instID stack to know which instance the user geometry object resides.

If not ray query context is specified when tracing a ray, a default context is used.

### EXIT STATUS
No error code is set by this function.

### SEE ALSO
[rtcIntersect1], [rtcIntersect4/8/16], [rtcOccluded1], [rtcOccluded4/8/16]


rtcInterpolate

title: rtcInterpolate(4embree4)

text:
# rtcInterpolate(4embree4)

### NAME

```
rtcInterpolate - interpolates vertex attributes

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCInterpolateArguments
{

  RTCGeometry geometry;

  unsigned int primID;

  float u;

  float v;

  enum RTCBufferType bufferType;

  unsigned int bufferSlot;

  float* P;

  float* dPdu;

  float* dPdv;

  float* ddPdudu;

  float* ddPdvdv;

  float* ddPdudv;

  unsigned int valueCount;
};
void rtcInterpolate(

  const struct RTCInterpolateArguments* args
);

```

### DESCRIPTION
The rtcInterpolate function smoothly interpolates per-vertex data over the geometry. This interpolation is supported for triangle meshes, quad meshes, curve geometries, and subdivision geometries. Apart from interpolating the vertex attribute itself, it is also possible to get the first and second order derivatives of that value. This interpolation ignores displacements of subdivision surfaces and always interpolates the underlying base surface.

The rtcInterpolate call gets passed a number of arguments inside a structure of type RTCInterpolateArguments. For some geometry (geometry parameter) this function smoothly interpolates the per-vertex data stored inside the specified geometry buffer (bufferType and bufferSlot parameters) to the u/v location (u and v parameters) of the primitive (primID parameter). The number of floating point values to interpolate and store to the destination arrays can be specified using the valueCount parameter. As interpolation buffer, one can specify vertex buffers (RTC_BUFFER_TYPE_VERTEX) and vertex attribute buffers (RTC_BUFFER_TYPE_VERTEX_ATTRIBUTE) as well.

The rtcInterpolate call stores valueCount number of interpolated floating point values to the memory location pointed to by P. One can avoid storing the interpolated value by setting P to NULL.

The first order derivative of the interpolation by u and v are stored at the dPdu and dPdv memory locations. One can avoid storing first order derivatives by setting both dPdu and dPdv to NULL.

The second order derivatives are stored at the ddPdudu, ddPdvdv, and ddPdudv memory locations. One can avoid storing second order derivatives by setting these three pointers to NULL.

To use rtcInterpolate for a geometry, all changes to that geometry must be properly committed using rtcCommitGeometry.

All input buffers and output arrays must be padded to 16 bytes, as the implementation uses 16-byte SSE instructions to read and write into these buffers.

See tutorial [Interpolation] for an example of using the rtcInterpolate function.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcInterpolateN]


rtcInterpolateN

title: rtcInterpolateN(4embree4)

text:
# rtcInterpolateN(4embree4)

### NAME

```
rtcInterpolateN - performs N interpolations of vertex attribute data

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTCInterpolateNArguments
{

  RTCGeometry geometry;

  const void* valid;

  const unsigned int* primIDs;

  const float* u;

  const float* v;

  unsigned int N;

  enum RTCBufferType bufferType;

  unsigned int bufferSlot;

  float* P;

  float* dPdu;

  float* dPdv;

  float* ddPdudu;

  float* ddPdvdv;

  float* ddPdudv;

  unsigned int valueCount;
};
void rtcInterpolateN(

  const struct RTCInterpolateNArguments* args
);

```

### DESCRIPTION
The rtcInterpolateN is similar to rtcInterpolate, but performs N many interpolations at once. It additionally gets an array of u/v coordinates and a valid mask (valid parameter) that specifies which of these coordinates are valid. The valid mask points to N integers, and a value of -1 denotes valid and 0 invalid. If the valid pointer is NULL all elements are considers valid. The destination arrays are filled in structure of array (SOA) layout. The value N must be divisible by 4.

To use rtcInterpolateN for a geometry, all changes to that geometry must be properly committed using rtcCommitGeometry.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcInterpolate]


title: rtcIntersect1(4embree4)

text:
# rtcIntersect1(4embree4)

### NAME

```
rtcIntersect1 - finds the closest hit for a single ray

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcIntersect1(

  RTCScene scene,

  struct RTCRayHit* rayhit

  struct RTCIntersectArguments* args = NULL
);

```

### DESCRIPTION
The rtcIntersect1 function finds the closest hit of a single ray (rayhit argument) with the scene (scene argument). The provided ray/hit structure contains the ray to intersect and some hit output fields that are filled when a hit is found. The passed optional arguments struct (args argument) can get used for advanced use cases, see section [rtcInitIntersectArguments] for more details.

To trace a ray, the user has to initialize the ray origin (org ray member), ray direction (dir ray member), ray segment (tnear, tfar ray members), ray mask (mask ray member), and set the ray flags to 0 (flags ray member). The ray time (time ray member) must be initialized to a value in the range $[0, 1]. The ray segment has to be in the range [0, ∞], thus ranges that start behind the ray origin are not valid, but ranges can reach to infinity. See Section [RTCRay] for the ray layout description.

The geometry ID (geomID hit member) of the hit data must be initialized to RTC_INVALID_GEOMETRY_ID (-1).

When no intersection is found, the ray/hit data is not updated. When an intersection is found, the hit distance is written into the tfar member of the ray and all hit data is set, such as unnormalized geometry normal in object space (Ng hit member), local hit coordinates (u, v hit member), instance ID stack (instID hit member), geometry ID (geomID hit member), and primitive ID (primID hit member). See Section [RTCHit] for the hit layout description.

If the instance ID stack has a prefix of values not equal to RTC_INVALID_GEOMETRY_ID, the instance ID on each level corresponds to the geometry ID of the hit instance of the higher-level scene, the geometry ID corresponds to the hit geometry inside the hit instanced scene, and the primitive ID corresponds to the n-th primitive of that geometry.

If level 0 of the instance ID stack is equal to RTC_INVALID_GEOMETRY_ID, the geometry ID corresponds to the hit geometry inside the top-level scene, and the primitive ID corresponds to the n-th primitive of that geometry.

The implementation makes no guarantees that primitives whose hit distance is exactly at (or very close to) tnear or tfar are hit or missed. If you want to exclude intersections at tnear just pass a slightly enlarged tnear, and if you want to include intersections at tfar pass a slightly enlarged tfar.

```

```

The ray/hit structure must be aligned to 16 bytes.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcOccluded1], [rtcIntersect4/8/16], [RTCRayHit], [rtcInitIntersectArguments]


title: rtcIntersect4(4embree4)

text:
# rtcIntersect4(4embree4)

### NAME

```
rtcIntersect4/8/16 - finds the closest hits for a ray packet

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcIntersect4(

  const int* valid,

  RTCScene scene,

  struct RTCRayHit4* rayhit,

  struct RTCIntersectArguments* args = NULL
);
void rtcIntersect8(

  const int* valid,

  RTCScene scene,

  struct RTCRayHit8* rayhit,

  struct RTCIntersectArguments* args = NULL
);
void rtcIntersect16(

  const int* valid,

  RTCScene scene,

  struct RTCRayHit16* rayhit,

  struct RTCIntersectArguments* args = NULL
);

```

### DESCRIPTION
The rtcIntersect4/8/16 functions finds the closest hits for a ray packet of size 4, 8, or 16 (rayhit argument) with the scene (scene argument). The ray/hit input contains a ray packet and hit packet. The passed optional arguments struct (args argument) are used to pass additional arguments for advanced features. See Section [rtcIntersect1] for more details and a description of how to set up and trace rays.

A ray valid mask must be provided (valid argument) which stores one 32-bit integer (-1 means valid and 0 invalid) per ray in the packet. Only active rays are processed, and hit data of inactive rays is not changed.

```

```

For rtcIntersect4 the ray packet must be aligned to 16 bytes, for rtcIntersect8 the alignment must be 32 bytes, and for rtcIntersect16 the alignment must be 64 bytes.

The rtcIntersect4, rtcIntersect8 and rtcIntersect16 functions may change the ray packet size and ray order when calling back into filter functions or user geometry callbacks. Under some conditions the application can assume packets to stay intakt, which can determined by querying the RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED, RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED, RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED properties through the rtcGetDeviceProperty function. See [rtcGetDeviceProperty] for more information.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcIntersect1], [rtcOccluded4/8/16], [rtcInitIntersectArguments]


rtcInvokeIntersectFilterFromGeometry

text:
# rtcInvokeIntersectFilterFromGeometry(4embree4)

### NAME

```
rtcInvokeIntersectFilterFromGeometry - invokes the

  intersection filter function from the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcInvokeIntersectFilterFromGeometry(

  const struct RTCIntersectFunctionNArguments* args,

  const struct RTCFilterFunctionNArguments* filterArgs
);

```

### DESCRIPTION
The rtcInvokeIntersectFilterFromGeometry function can be called inside an RTCIntersectFunctionN user geometry callback function to invoke the intersection filter registered to the geometry. For this an RTCFilterFunctionNArguments structure must be created (see rtcSetGeometryIntersectFilterFunction) which basically consists of a valid mask, a hit packet to filter, the corresponding ray packet, and the packet size. After the invocation of rtcInvokeIntersectFilterFromGeometry, only rays that are still valid (valid mask set to -1) should update a hit.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcInvokeOccludedFilterFromGeometry], [rtcSetGeometryIntersectFunction]


rtcInvokeOccludedFilterFromGeometry

text:
# rtcInvokeOccludedFilterFromGeometry(4embree4)

### NAME

```
rtcInvokeOccludedFilterFromGeometry - invokes the occlusion

  filter function from the geometry

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcInvokeOccludedFilterFromGeometry(

  const struct RTCOccludedFunctionNArguments* args,

  const struct RTCFilterFunctionNArguments* filterArgs
);

```

### DESCRIPTION
The rtcInvokeOccludedFilterFromGeometry function can be called inside an RTCOccludedFunctionN user geometry callback function to invoke the occlusion filter registered to the geometry. For this an RTCFilterFunctionNArguments structure must be created (see rtcSetGeometryIntersectFilterFunction) which basically consists of a valid mask, a hit packet to filter, the corresponding ray packet, and the packet size. After the invocation of rtcInvokeOccludedFilterFromGeometry only rays that are still valid (valid mask set to -1) should signal an occlusion.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcInvokeIntersectFilterFromGeometry], [rtcSetGeometryOccludedFunction]


rtcIsSYCLDeviceSupported

title: rtcIsSYCLDeviceSupported(4embree4)

text:
# rtcIsSYCLDeviceSupported(4embree4)

### NAME

```
rtcIsSYCLDeviceSupported - checks if some SYCL device is supported by Embree

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
bool rtcIsSYCLDeviceSupported(const sycl::device sycl_device);

```

### DESCRIPTION
This function can be used to check if some SYCL device (sycl_device argument) is supported by Embree.

### EXIT STATUS
The function returns true if the SYCL device is supported by Embree and false otherwise. On failure an error code is set that can get queried using rtcGetDeviceError.

### SEE ALSO
[rtcSYCLDeviceSelector]


rtcJoinCommitScene

title: rtcJoinCommitScene(4embree4)

text:
# rtcJoinCommitScene(4embree4)

### NAME

```
rtcJoinCommitScene - commits the scene from multiple threads

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcJoinCommitScene(RTCScene scene);

```

### DESCRIPTION
The rtcJoinCommitScene function commits all changes for the specified scene (scene argument). The scene commit internally triggers building of a spatial acceleration structure for the scene. Ray queries can be performed after scene changes got properly committed.

The rtcJoinCommitScene function can get called from multiple user threads which will all cooperate in the build operation. All threads calling into this function will return from rtcJoinCommitScene after the scene commit is finished. All threads must consistently call rtcJoinCommitScene and not rtcCommitScene.

In contrast to the rtcCommitScene function, the rtcJoinCommitScene function can be called from multiple user threads, while the rtcCommitScene can only get called from multiple TBB worker threads when used concurrently. For optimal performance we strongly recommend using TBB inside the application together with the rtcCommitScene function and to avoid using the rtcJoinCommitScene function.

The rtcJoinCommitScene feature allows a flexible way to lazily create hierarchies during rendering. A thread reaching a not-yet-constructed sub-scene of a two-level scene can generate the sub-scene geometry and call rtcJoinCommitScene on that just generated scene. During construction, further threads reaching the not-yet-built scene can join the build operation by also invoking rtcJoinCommitScene. A thread that calls rtcJoinCommitScene after the build finishes will directly return from the rtcJoinCommitScene call.

Multiple scene commit operations on different scenes can be running at the same time, hence it is possible to commit many small scenes in parallel, distributing the commits to many threads.

When using Embree with the Intel® Threading Building Blocks (which is the default), threads that call rtcJoinCommitScene will join the build operation, but other TBB worker threads might also participate in the build. To avoid thread oversubscription, we recommend using TBB also inside the application. Further, the join mode only works properly starting with TBB v4.4 Update 1. For earlier TBB versions, threads that call rtcJoinCommitScene to join a running build will just trigger the build and wait for the build to finish. Further, old TBB versions with TBB_INTERFACE_VERSION_MAJOR < 8 do not support rtcJoinCommitScene, and invoking this function will result in an error.

When using Embree with the internal tasking system, only threads that call rtcJoinCommitScene will perform the build operation, and no additional worker threads will be scheduled.

When using Embree with the Parallel Patterns Library (PPL), rtcJoinCommitScene is not supported and calling that function will result in an error.

To detect whether rtcJoinCommitScene is supported, use the rtcGetDeviceProperty function.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcCommitScene], [rtcGetDeviceProperty]


rtcNewBVH

title: rtcNewBVH(4embree4)

text:
# rtcNewBVH(4embree4)

### NAME

```
rtcNewBVH - creates a new BVH object

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCBVH rtcNewBVH(RTCDevice device);

```

### DESCRIPTION
This function creates a new BVH object and returns a handle to this BVH. The BVH object is reference counted with an initial reference count of 1. The handle can be released using the rtcReleaseBVH API call.

The BVH object can be used to build a BVH in a user-specified format over user-specified primitives. See the documentation of the rtcBuildBVH call for more details.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcRetainBVH], [rtcReleaseBVH], [rtcBuildBVH]


rtcNewBuffer

title: rtcNewBuffer(4embree4)

text:
# rtcNewBuffer(4embree4)

### NAME

```
rtcNewBuffer - creates a new data buffer

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCBuffer rtcNewBuffer(

  RTCDevice device,

  size_t byteSize
);

```

### DESCRIPTION
The rtcNewBuffer function creates a new data buffer object of specified size in bytes (byteSize argument) that is bound to the specified device (device argument). The buffer object is reference counted with an initial reference count of 1. The returned buffer object can be released using the rtcReleaseBuffer API call. The specified number of bytes are allocated at buffer construction time and deallocated when the buffer is destroyed.

```

```

### EXIT STATUS
On failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcRetainBuffer], [rtcReleaseBuffer]


rtcNewDevice

title: rtcNewDevice(4embree4)

text:
# rtcNewDevice(4embree4)

### NAME

```
rtcNewDevice - creates a new device

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCDevice rtcNewDevice(const char* config);

```

### DESCRIPTION
This function creates a new device to be used for CPU ray tracing and returns a handle to this device. The device object is reference counted with an initial reference count of 1. The handle can be released using the rtcReleaseDevice API call.

The device object acts as a class factory for all other object types. All objects created from the device (like scenes, geometries, etc.) hold a reference to the device, thus the device will not be destroyed unless these objects are destroyed first.

Objects are only compatible if they belong to the same device, e.g it is not allowed to create a geometry in one device and attach it to a scene created with a different device.

A configuration string (config argument) can be passed to the device construction. This configuration string can be NULL to use the default configuration.

The following configuration is supported:

•

threads=[int]: Specifies a number of build threads to use. A value of 0 enables all detected hardware threads. By default all hardware threads are used.

•

user_threads=[int]: Sets the number of user threads that can be used to join and participate in a scene commit using rtcJoinCommitScene. The tasking system will only use threads-user_threads many worker threads, thus if the app wants to solely use its threads to commit scenes, just set threads equal to user_threads. This option only has effect with the Intel(R) Threading Building Blocks (TBB) tasking system.

•

set_affinity=[0/1]: When enabled, build threads are affinitized to hardware threads. This option is disabled by default on standard CPUs, and enabled by default on Xeon Phi Processors.

•

start_threads=[0/1]: When enabled, the build threads are started upfront. This can be useful for benchmarking to exclude thread creation time. This option is disabled by default.

•

isa=[sse2,sse4.2,avx,avx2,avx512]: Use specified ISA. By default the ISA is selected automatically.

•

max_isa=[sse2,sse4.2,avx,avx2,avx512]: Configures the automated ISA selection to use maximally the specified ISA.

•

hugepages=[0/1]: Enables or disables usage of huge pages. Under Linux huge pages are used by default but under Windows and macOS they are disabled by default.

•

enable_selockmemoryprivilege=[0/1]: When set to 1, this enables the SeLockMemoryPrivilege privilege with is required to use huge pages on Windows. This option has an effect only under Windows and is ignored on other platforms. See Section [Huge Page Support] for more details.

•

verbose=[0,1,2,3]: Sets the verbosity of the output. When set to 0, no output is printed by Embree, when set to a higher level more output is printed. By default Embree does not print anything on the console.

•

frequency_level=[simd128,simd256,simd512]: Specifies the frequency level the application want to run on, which can be either:

a)

simd128 to run at highest frequency

b)

simd256 to run at AVX2-heavy frequency level

c)

simd512 to run at heavy AVX512 frequency level. When some frequency level is specified, Embree will avoid doing optimizations that may reduce the frequency level below the level specified. E.g. if your app does not use AVX instructions setting “frequency_level=simd128” will cause some CPUs to run at highest frequency, which may result in higher application performance if you do much shading. If you application heavily uses AVX code, you should best set the frequency level to simd256. Per default Embree tries to avoid reducing the frequency of the CPU by setting the simd256 level only when the CPU has no significant down clocking.

Different configuration options should be separated by commas, e.g.:

```
rtcNewDevice("threads=1,isa=avx");

```

### EXIT STATUS
On success returns a handle of the created device. On failure returns NULL as device and sets a per-thread error code that can be queried using rtcGetDeviceError(NULL).

### SEE ALSO
[rtcRetainDevice], [rtcReleaseDevice], [rtcNewSYCLDevice]


rtcNewGeometry

title: rtcNewGeometry(4embree4)

text:
# rtcNewGeometry(4embree4)

### NAME

```
rtcNewGeometry - creates a new geometry object

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
enum RTCGeometryType
{

 RTC_GEOMETRY_TYPE_TRIANGLE,

 RTC_GEOMETRY_TYPE_QUAD,

 RTC_GEOMETRY_TYPE_SUBDIVISION,

 RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE,

 RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE,

 RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE,

 RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE,

 RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE,

 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BEZIER_CURVE,

 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BSPLINE_CURVE,

 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_HERMITE_CURVE,

 RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_CATMULL_ROM_CURVE,

 RTC_GEOMETRY_TYPE_CONE_LINEAR_CURVE,

 RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE,

 RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE,

 RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE,

 RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE,

 RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE,

 RTC_GEOMETRY_TYPE_GRID,

 RTC_GEOMETRY_TYPE_SPHERE_POINT,

 RTC_GEOMETRY_TYPE_DISC_POINT,

 RTC_GEOMETRY_TYPE_ORIENTED_DISC_POINT,

 RTC_GEOMETRY_TYPE_USER,

 RTC_GEOMETRY_TYPE_INSTANCE,

 RTC_GEOMETRY_TYPE_INSTANCE_ARRAY,
};
RTCGeometry rtcNewGeometry(

  RTCDevice device,

  enum RTCGeometryType type
);

```

### DESCRIPTION
Geometries are objects that represent an array of primitives of the same type. The rtcNewGeometry function creates a new geometry of specified type (type argument) bound to the specified device (device argument) and returns a handle to this geometry. The geometry object is reference counted with an initial reference count of 1. The geometry handle can be released using the rtcReleaseGeometry API call.

Supported geometry types are triangle meshes (RTC_GEOMETRY_TYPE_TRIANGLE type), quad meshes (triangle pairs) (RTC_GEOMETRY_TYPE_QUAD type), Catmull-Clark subdivision surfaces (RTC_GEOMETRY_TYPE_SUBDIVISION type), curve geometries with different bases (RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE, RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE,

RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE, RTC_GEOMETRY_TYPE_FLAT_HERMITE_CURVE,

RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BEZIER_CURVE, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_BSPLINE_CURVE, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_HERMITE_CURVE, RTC_GEOMETRY_TYPE_NORMAL_ORIENTED_CATMULL_ROM_CURVE, RTC_GEOMETRY_TYPE_CONE_LINEAR_CURVE, RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE, RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE, RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE, RTC_GEOMETRY_TYPE_ROUND_HERMITE_CURVE, RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE types) grid meshes (RTC_GEOMETRY_TYPE_GRID), point geometries (RTC_GEOMETRY_TYPE_SPHERE_POINT, RTC_GEOMETRY_TYPE_DISC_POINT, RTC_TYPE_ORIENTED_DISC_POINT), user-defined geometries (RTC_GEOMETRY_TYPE_USER), instances (RTC_GEOMETRY_TYPE_INSTANCE), and instance arrays (RTC_GEOMETRY_TYPE_INSTANCE_ARRAY).

The types RTC_GEOMETRY_TYPE_ROUND_BEZIER_CURVE, RTC_GEOMETRY_TYPE_ROUND_BSPLINE_CURVE, and RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE will treat the curve as a sweep surface of a varying-radius circle swept tangentially along the curve. The types RTC_GEOMETRY_TYPE_FLAT_BEZIER_CURVE, RTC_GEOMETRY_TYPE_FLAT_BSPLINE_CURVE, and RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE use ray-facing ribbons as a faster-to-intersect approximation.

After construction, geometries are enabled by default and not attached to any scene. Geometries can be disabled (rtcDisableGeometry call), and enabled again (rtcEnableGeometry call). A geometry can be attached to multiple scenes using the rtcAttachGeometry call (or rtcAttachGeometryByID call), and detached using the rtcDetachGeometry call. During attachment, a geometry ID is assigned to the geometry (or assigned by the user when using the rtcAttachGeometryByID call), which uniquely identifies the geometry inside that scene. This identifier is returned when primitives of the geometry are hit in later ray queries for the scene.

Geometries can also be modified, including their vertex and index buffers. After modifying a buffer, rtcUpdateGeometryBuffer must be called to notify that the buffer got modified.

The application can use the rtcSetGeometryUserData function to set a user data pointer to its own geometry representation, and later read out this pointer using the rtcGetGeometryUserData function.

After setting up the geometry or modifying it, rtcCommitGeometry must be called to finish the geometry setup. After committing the geometry, vertex data interpolation can be performed using the rtcInterpolate and rtcInterpolateN functions.

A build quality can be specified for a geometry using the rtcSetGeometryBuildQuality function, to balance between acceleration structure build performance and ray query performance. The build quality per geometry will be used if a two-level acceleration structure is built internally, which is the case if the RTC_BUILD_QUALITY_LOW is set as the scene build quality. See Section [rtcSetSceneBuildQuality] for more details.

### EXIT STATUS
On failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcEnableGeometry], [rtcDisableGeometry], [rtcAttachGeometry], [rtcAttachGeometryByID], [rtcUpdateGeometryBuffer], [rtcSetGeometryUserData], [rtcGetGeometryUserData], [rtcCommitGeometry], [rtcInterpolate], [rtcInterpolateN], [rtcSetGeometryBuildQuality], [rtcSetSceneBuildQuality], [RTC_GEOMETRY_TYPE_TRIANGLE], [RTC_GEOMETRY_TYPE_QUAD], [RTC_GEOMETRY_TYPE_SUBDIVISION], [RTC_GEOMETRY_TYPE_CURVE], [RTC_GEOMETRY_TYPE_GRID], [RTC_GEOMETRY_TYPE_POINT], [RTC_GEOMETRY_TYPE_USER], [RTC_GEOMETRY_TYPE_INSTANCE], [RTC_GEOMETRY_TYPE_INSTANCE_ARRAY]


rtcNewSYCLDevice

title: rtcNewSYCLDevice(4embree4)

text:
# rtcNewSYCLDevice(4embree4)

### NAME

```
rtcNewSYCLDevice - creates a new device to be used with SYCL

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCDevice rtcNewSYCLDevice(sycl::context context, const char* config);

```

### DESCRIPTION
This function creates a new device to be used with SYCL for GPU rendering and returns a handle to this device. The device object is reference counted with an initial reference count of 1. The handle can get released using the rtcReleaseDevice API call.

The passed SYCL context (context argument) is used to allocate GPU data, thus only devices contained inside this context can be used for rendering. By default the GPU data is allocated on the first GPU device of the context, but this behavior can get changed with the [rtcSetDeviceSYCLDevice] function.

The device object acts as a class factory for all other object types. All objects created from the device (like scenes, geometries, etc.) hold a reference to the device, thus the device will not be destroyed unless these objects are destroyed first.

Objects are only compatible if they belong to the same device, e.g it is not allowed to create a geometry in one device and attach it to a scene created with a different device.

For an overview of configurations that can get passed (config argument) please see the [rtcNewDevice] function description.

### EXIT STATUS
On success returns a handle of the created device. On failure returns NULL as device and sets a per-thread error code that can be queried using rtcGetDeviceError(NULL).

### SEE ALSO
[rtcRetainDevice], [rtcReleaseDevice], [rtcNewDevice]


rtcNewScene

title: rtcNewScene(4embree4)

text:
# rtcNewScene(4embree4)

### NAME

```
rtcNewScene - creates a new scene

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCScene rtcNewScene(RTCDevice device);

```

### DESCRIPTION
This function creates a new scene bound to the specified device (device argument), and returns a handle to this scene. The scene object is reference counted with an initial reference count of 1. The scene handle can be released using the rtcReleaseScene API call.

### EXIT STATUS
On success a scene handle is returned. On failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcRetainScene], [rtcReleaseScene]


rtcNewSharedBuffer

title: rtcNewSharedBuffer(4embree4)

text:
# rtcNewSharedBuffer(4embree4)

### NAME

```
rtcNewSharedBuffer - creates a new shared data buffer

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
RTCBuffer rtcNewSharedBuffer(

  RTCDevice device,

  void* ptr,

  size_t byteSize
);

```

### DESCRIPTION
The rtcNewSharedBuffer function creates a new shared data buffer object bound to the specified device (device argument). The buffer object is reference counted with an initial reference count of 1. The buffer can be released using the rtcReleaseBuffer function.

At construction time, the pointer to the user-managed buffer data (ptr argument) including its size in bytes (byteSize argument) is provided to create the buffer. At buffer construction time no buffer data is allocated, but the buffer data provided by the application is used. The buffer data must remain valid for as long as the buffer may be used, and the user is responsible to free the buffer data when no longer required.

```

```

The data pointer (ptr argument) must be aligned to 4 bytes; otherwise the rtcNewSharedBuffer function will fail.

### EXIT STATUS
On failure NULL is returned and an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcRetainBuffer], [rtcReleaseBuffer]


title: rtcOccluded1(4embree4)

text:
# rtcOccluded1(4embree4)

### NAME

```
rtcOccluded1 - finds any hit for a single ray

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcOccluded1(

  RTCScene scene,

  struct RTCRay* ray,

  struct RTCOccludedArguments* args = NULL
);

```

### DESCRIPTION
The rtcOccluded1 function checks for a single ray (ray argument) whether there is any hit with the scene (scene argument). The passed optional arguments struct (args argument) can get used for advanced use cases, see section [rtcInitOccludedArguments] for more details.

To trace a ray, the user must initialize the ray origin (org ray member), ray direction (dir ray member), ray segment (tnear, tfar ray members), ray mask (mask ray member), and must set the ray flags to 0 (flags ray member). The ray time (time ray member) must be initialized to a value in the range [0, 1]. The ray segment must be in the range [0, ∞], thus ranges that start behind the ray origin are not valid, but ranges can reach to infinity. See Section [RTCRay] for the ray layout description.

When no intersection is found, the ray data is not updated. In case a hit was found, the tfar component of the ray is set to -inf.

The implementation makes no guarantees that primitives whose hit distance is exactly at (or very close to) tnear or tfar are hit or missed. If you want to exclude intersections at tnear just pass a slightly enlarged tnear, and if you want to include intersections at tfar pass a slightly enlarged tfar.

```

```

The ray must be aligned to 16 bytes.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcIntersect1], [rtcOccluded4/8/16], [RTCRay], [rtcInitOccludedArguments]


title: rtcOccluded4(4embree4)

text:
# rtcOccluded4(4embree4)

### NAME

```
rtcOccluded4/8/16 - finds any hits for a ray packet

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcOccluded4(

  const int* valid,

  RTCScene scene,

  struct RTCRay4* ray,

  struct RTCOccludedArguments* args = NULL
);
void rtcOccluded8(

  const int* valid,

  RTCScene scene,

  struct RTCRay8* ray,

  struct RTCOccludedArguments* args = NULL
);
void rtcOccluded16(

  const int* valid,

  RTCScene scene,

  struct RTCRay16* ray,

  struct RTCOccludedArguments* args = NULL
);

```

### DESCRIPTION
The rtcOccluded4/8/16 functions checks for each active ray of the ray packet of size 4, 8, or 16 (ray argument) whether there is any hit with the scene (scene argument). The passed optional arguments struct (args argument) can get used for advanced use cases, see section [rtcInitOccludedArguments] for more details. See Section [rtcOccluded1] for more details and a description of how to set up and trace occlusion rays.

A ray valid mask must be provided (valid argument) which stores one 32-bit integer (-1 means valid and 0 invalid) per ray in the packet. Only active rays are processed, and hit data of inactive rays is not changed.

```

```

For rtcOccluded4 the ray packet must be aligned to 16 bytes, for rtcOccluded8 the alignment must be 32 bytes, and for rtcOccluded16 the alignment must be 64 bytes.

The rtcOccluded4, rtcOccluded8 and rtcOccluded16 functions may change the ray packet size and ray order when calling back into intersect filter functions or user geometry callbacks. Under some conditions the application can assume packets to stay intakt, which can determined by querying the RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED, RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED, RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED properties through the rtcGetDeviceProperty function. See [rtcGetDeviceProperty] for more information.

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcOccluded1], [rtcIntersect4/8/16], [rtcInitOccludedArguments]


rtcPointQuery

title: rtcPointQuery(4embree4)

text:
# rtcPointQuery(4embree4)

### NAME

```
rtcPointQuery - traverses the BVH with a point query object

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
struct RTC_ALIGN(16) RTCPointQuery
{

  // location of the query

  float x;

  float y;

  float z;

  // radius and time of the query

  float radius;

  float time;
};
void rtcPointQuery(

  RTCScene scene,

  struct RTCPointQuery* query,

  struct RTCPointQueryContext* context,

  struct RTCPointQueryFunction* queryFunc,

  void* userPtr
);

```

### DESCRIPTION
The rtcPointQuery function traverses the BVH using a RTCPointQuery object (query argument) and calls a user defined callback function (e.g queryFunc argument) for each primitive of the scene (scene argument) that intersects the query domain.

The user has to initialize the query location (x, y and z member) and query radius in the range [0, ∞]. If the scene contains motion blur geometries, also the query time (time member) must be initialized to a value in the range [0, 1].

Further, a RTCPointQueryContext (context argument) must be created and initialized. It contains ID and transformation information of the instancing hierarchy if (multilevel-)instancing is used. See [rtcInitPointQueryContext] for further information.

For every primitive that intersects the query domain, the callback function (queryFunc argument) is called, in which distance computations to the primitive can be implemented. The user will be provided with the primID and geomID of the according primitive, however, the geometry information (e.g. triangle index and vertex data) has to be determined manually. The userPtr argument can be used to input geometry data of the scene or output results of the point query (e.g. closest point currently found on surface geometry (see tutorial [ClosestPoint])).

The parameter queryFunc is optional and can be NULL, in which case the callback function is not invoked. However, a callback function can still get attached to a specific RTCGeometry object using [rtcSetGeometryPointQueryFunction]. If a callback function is attached to a geometry and (a potentially different) callback function is passed as an argument to rtcPointQuery, both functions are called for the primitives of the according geometries.

The query radius can be decreased inside the callback function, which allows to efficiently cull parts of the scene during BVH traversal. Increasing the query radius and modifying time or location of the query will result in undefined behaviour.

The callback function will be called for all primitives in a leaf node of the BVH even if the primitive is outside the query domain, since Embree does not gather geometry information of primitives internally.

Point queries can be used with (multilevel)-instancing. However, care has to be taken when the instance transformation contains anisotropic scaling or sheering. In these cases distance computations have to be performed in world space to ensure correctness and the ellipsoidal query domain (in instance space) will be approximated with its axis aligned bounding box internally. Therefore, the callback function might be invoked even for primitives in inner BVH nodes that do not intersect the query domain. See [rtcSetGeometryPointQueryFunction] for details.

The point query structure must be aligned to 16 bytes.

### SUPPORTED PRIMITIVES
Currently, all primitive types are supported by the point query API except of points (see [RTC_GEOMETRY_TYPE_POINT]), curves (see [RTC_GEOMETRY_TYPE_CURVE]) and sudivision surfaces (see [RTC_GEOMETRY_SUBDIVISION]).

### EXIT STATUS
For performance reasons this function does not do any error checks, thus will not set any error flags on failure.

### SEE ALSO
[rtcSetGeometryPointQueryFunction], [rtcInitPointQueryContext]


title: rtcPointQuery4(4embree4)

text:
# rtcPointQuery4(4embree4)

### NAME

```
rtcPointQuery4/8/16 - traverses the BVH with a point query object for a ray packet

```

### DESCRIPTION
The rtcPointQuery4/8/16 function unrolls the ray packet internally and calls [rtcPointQuery].

### SEE ALSO
[rtcPointQuery]


rtcReleaseBVH

title: rtcReleaseBVH(4embree4)

text:
# rtcReleaseBVH(4embree4)

### NAME

```
rtcReleaseBVH - decrements the BVH reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcReleaseBVH(RTCBVH bvh);

```

### DESCRIPTION
BVH objects are reference counted. The rtcReleaseBVH function decrements the reference count of the passed BVH object (bvh argument). When the reference count falls to 0, the BVH gets destroyed.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewBVH], [rtcRetainBVH]


rtcReleaseBuffer

title: rtcReleaseBuffer(4embree4)

text:
# rtcReleaseBuffer(4embree4)

### NAME

```
rtcReleaseBuffer - decrements the buffer reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcReleaseBuffer(RTCBuffer buffer);

```

### DESCRIPTION
Buffer objects are reference counted. The rtcReleaseBuffer function decrements the reference count of the passed buffer object (buffer argument). When the reference count falls to 0, the buffer gets destroyed.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewBuffer], [rtcRetainBuffer]


rtcReleaseDevice

title: rtcReleaseDevice(4embree4)

text:
# rtcReleaseDevice(4embree4)

### NAME

```
rtcReleaseDevice - decrements the device reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcReleaseDevice(RTCDevice device);

```

### DESCRIPTION
Device objects are reference counted. The rtcReleaseDevice function decrements the reference count of the passed device object (device argument). When the reference count falls to 0, the device gets destroyed.

All objects created from the device (like scenes, geometries, etc.) hold a reference to the device, thus the device will not get destroyed unless these objects are destroyed first.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewDevice], [rtcRetainDevice]


rtcReleaseGeometry

title: rtcReleaseGeometry(4embree4)

text:
# rtcReleaseGeometry(4embree4)

### NAME

```
rtcReleaseGeometry - decrements the geometry reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcReleaseGeometry(RTCGeometry geometry);

```

### DESCRIPTION
Geometry objects are reference counted. The rtcReleaseGeometry function decrements the reference count of the passed geometry object (geometry argument). When the reference count falls to 0, the geometry gets destroyed.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewGeometry], [rtcRetainGeometry]


rtcReleaseScene

title: rtcReleaseScene(4embree4)

text:
# rtcReleaseScene(4embree4)

### NAME

```
rtcReleaseScene - decrements the scene reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcReleaseScene(RTCScene scene);

```

### DESCRIPTION
Scene objects are reference counted. The rtcReleaseScene function decrements the reference count of the passed scene object (scene argument). When the reference count falls to 0, the scene gets destroyed.

The scene holds a reference to all attached geometries, thus if the scene gets destroyed, all geometries get detached and their reference count decremented.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewScene], [rtcRetainScene]


rtcRetainBVH

title: rtcRetainBVH(4embree4)

text:
# rtcRetainBVH(4embree4)

### NAME

```
rtcRetainBVH - increments the BVH reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcRetainBVH(RTCBVH bvh);

```

### DESCRIPTION
BVH objects are reference counted. The rtcRetainBVH function increments the reference count of the passed BVH object (bvh argument). This function together with rtcReleaseBVH allows to use the internal reference counting in a C++ wrapper class to handle the ownership of the object.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewBVH], [rtcReleaseBVH]


rtcRetainBuffer

title: rtcRetainBuffer(4embree4)

text:
# rtcRetainBuffer(4embree4)

### NAME

```
rtcRetainBuffer - increments the buffer reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcRetainBuffer(RTCBuffer buffer);

```

### DESCRIPTION
Buffer objects are reference counted. The rtcRetainBuffer function increments the reference count of the passed buffer object (buffer argument). This function together with rtcReleaseBuffer allows to use the internal reference counting in a C++ wrapper class to handle the ownership of the object.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewBuffer], [rtcReleaseBuffer]


rtcRetainDevice

title: rtcRetainDevice(4embree4)

text:
# rtcRetainDevice(4embree4)

### NAME

```
rtcRetainDevice - increments the device reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcRetainDevice(RTCDevice device);

```

### DESCRIPTION
Device objects are reference counted. The rtcRetainDevice function increments the reference count of the passed device object (device argument). This function together with rtcReleaseDevice allows to use the internal reference counting in a C++ wrapper class to manage the ownership of the object.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewDevice], [rtcReleaseDevice]


rtcRetainGeometry

title: rtcRetainGeometry(4embree4)

text:
# rtcRetainGeometry(4embree4)

### NAME

```
rtcRetainGeometry - increments the geometry reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcRetainGeometry(RTCGeometry geometry);

```

### DESCRIPTION
Geometry objects are reference counted. The rtcRetainGeometry function increments the reference count of the passed geometry object (geometry argument). This function together with rtcReleaseGeometry allows to use the internal reference counting in a C++ wrapper class to handle the ownership of the object.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewGeometry], [rtcReleaseGeometry]


rtcRetainScene

title: rtcRetainScene(4embree4)

text:
# rtcRetainScene(4embree4)

### NAME

```
rtcRetainScene - increments the scene reference count

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcRetainScene(RTCScene scene);

```

### DESCRIPTION
Scene objects are reference counted. The rtcRetainScene function increments the reference count of the passed scene object (scene argument). This function together with rtcReleaseScene allows to use the internal reference counting in a C++ wrapper class to handle the ownership of the object.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewScene], [rtcReleaseScene]


rtcSYCLDeviceSelector

title: rtcSYCLDeviceSelector(4embree4)

text:
# rtcSYCLDeviceSelector(4embree4)

### NAME

```
rtcSYCLDeviceSelector - SYCL device selector function to select

  devices supported by Embree

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
int rtcSYCLDeviceSelector(const sycl::device sycl_device);

```

### DESCRIPTION
This function checks if the passed SYCL device (sycl_device arguments) is supported by Embree or not. This function can be used directly to select some supported SYCL device by using it as SYCL device selector function. For instance, the following code sequence selects an Embree supported SYCL device and creates an Embree device from it:

```
sycl::device sycl_device(rtcSYCLDeviceSelector);
sycl::queue sycl_queue(sycl_device);
sycl::context(sycl_device);
RTCDevice device = rtcNewSYCLDevice(sycl_context,nullptr);

```

### EXIT STATUS
The function returns -1 if the SYCL device is supported by Embree and 1 otherwise. On failure an error code is set that can get queried using rtcGetDeviceError.

### SEE ALSO
[rtcIsSYCLDeviceSupported]


rtcSetDeviceErrorFunction

title: rtcSetDeviceErrorFunction(4embree4)

text:
# rtcSetDeviceErrorFunction(4embree4)

### NAME

```
rtcSetDeviceErrorFunction - sets an error callback function for the device

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
typedef void (*RTCErrorFunction)(

  void* userPtr,

  RTCError code,

  const char* str
);
void rtcSetDeviceErrorFunction(

  RTCDevice device,

  RTCErrorFunction error,

  void* userPtr
);

```

### DESCRIPTION
Using the rtcSetDeviceErrorFunction call, it is possible to set a callback function (error argument) with payload (userPtr argument), which is called whenever an error occurs for the specified device (device argument).

Only a single callback function can be registered per device, and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

When the registered callback function is invoked, it gets passed the user-defined payload (userPtr argument as specified at registration time), the error code (code argument) of the occurred error, as well as a string (str argument) that further describes the error.

The error code is also set if an error callback function is registered.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcGetDeviceError]


rtcSetDeviceMemoryMonitorFunction

text:
# rtcSetDeviceMemoryMonitorFunction(4embree4)

### NAME

```
rtcSetDeviceMemoryMonitorFunction - registers a callback function

  to track memory consumption

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
typedef bool (*RTCMemoryMonitorFunction)(

  void* userPtr,

  ssize_t bytes,

  bool post
);
void rtcSetDeviceMemoryMonitorFunction(

  RTCDevice device,

  RTCMemoryMonitorFunction memoryMonitor,

  void* userPtr
);

```

### DESCRIPTION
Using the rtcSetDeviceMemoryMonitorFunction call, it is possible to register a callback function (memoryMonitor argument) with payload (userPtr argument) for a device (device argument), which is called whenever internal memory is allocated or deallocated by objects of that device. Using this memory monitor callback mechanism, the application can track the memory consumption of an Embree device, and optionally terminate API calls that consume too much memory.

Only a single callback function can be registered per device, and further invocations overwrite the previously set callback function. Passing NULL as function pointer disables the registered callback function.

Once registered, the Embree device will invoke the memory monitor callback function before or after it allocates or frees important memory blocks. The callback function gets passed the payload as specified at registration time (userPtr argument), the number of bytes allocated or deallocated (bytes argument), and whether the callback is invoked after the allocation or deallocation took place (post argument). The callback function might get called from multiple threads concurrently.

The application can track the current memory usage of the Embree device by atomically accumulating the bytes input parameter provided to the callback function. This parameter will be >0 for allocations and <0 for deallocations.

Embree will continue its operation normally when returning true from the callback function. If false is returned, Embree will cancel the current operation with the RTC_ERROR_OUT_OF_MEMORY error code. Issuing multiple cancel requests from different threads is allowed. Canceling will only happen when the callback was called for allocations (bytes > 0), otherwise the cancel request will be ignored.

If a callback to cancel was invoked before the allocation happens (post == false), then the bytes parameter should not be accumulated, as the allocation will never happen. If the callback to cancel was invoked after the allocation happened (post == true), then the bytes parameter should be accumulated, as the allocation properly happened and a deallocation will later free that data block.

### EXIT STATUS
On failure an error code is set that can be queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewDevice]


rtcSetDeviceSYCLDevice

title: rtcSetDeviceSYCLDevice(4embree4)

text:
# rtcSetDeviceSYCLDevice(4embree4)

### NAME

```
rtcSetDeviceSYCLDevice - sets the SYCL device to be used for memory allocations

```

### SYNOPSIS

```
#include <embree4/rtcore.h>
void rtcSetDeviceSYCLDevice(RTCDevice device, const sycl::device sycl_device);

```

### DESCRIPTION
This function sets the SYCL device (sycl_device argument) to be used to allocate GPU memory when using the specified Embree device (device argument). This SYCL device must be one of the SYCL devices contained inside the SYCL context used to create the Embree device.

### EXIT STATUS
On failure an error code is set that can get queried using rtcGetDeviceError.

### SEE ALSO
[rtcNewSYCLDevice]