.TH "rtcSetSharedGeometryBuffer" "3" "" "" "Embree Ray Tracing Kernels 3"
.SS NAME
.IP
.nf
\f[C]
rtcSetSharedGeometryBuffer\ \-\ assigns\ a\ view\ of\ a\ shared\ data\ buffer
\ \ to\ a\ geometry
\f[]
.fi
.SS SYNOPSIS
.IP
.nf
\f[C]
#include\ <embree3/rtcore.h>

void\ rtcSetSharedGeometryBuffer(
\ \ RTCGeometry\ geometry,
\ \ enum\ RTCBufferType\ type,
\ \ unsigned\ int\ slot,
\ \ enum\ RTCFormat\ format,
\ \ const\ void*\ ptr,
\ \ size_t\ byteOffset,
\ \ size_t\ byteStride,
\ \ size_t\ itemCount
);
\f[]
.fi
.SS DESCRIPTION
.PP
The \f[C]rtcSetSharedGeometryBuffer\f[] function binds a view of a
shared user\-managed data buffer (\f[C]ptr\f[] argument) to a geometry
buffer type and slot (\f[C]type\f[] and \f[C]slot\f[] argument) of the
specified geometry (\f[C]geometry\f[] argument).
.PP
One can specify the start of the first buffer element in bytes
(\f[C]byteOffset\f[] argument), the byte stride between individual
buffer elements (\f[C]byteStride\f[] argument), the format of the buffer
elements (\f[C]format\f[] argument), and the number of elements to bind
(\f[C]itemCount\f[]).
.PP
The start address (\f[C]byteOffset\f[] argument) and stride
(\f[C]byteStride\f[] argument) must be both aligned to 4 bytes;
otherwise the \f[C]rtcSetGeometryBuffer\f[] function will fail.
.IP
.nf
\f[C]
\f[]
.fi
.PP
The buffer data must remain valid for as long as the buffer may be used,
and the user is responsible for freeing the buffer data when no longer
required.
.PP
Sharing buffers can significantly reduce the memory required by the
application, thus we recommend using this feature.
When enabling the \f[C]RTC_SCENE_COMPACT\f[] scene flag, the spatial
index structures index into the vertex buffer, resulting in even higher
memory savings.
.SS EXIT STATUS
.PP
On failure an error code is set that can be queried using
\f[C]rtcGetDeviceError\f[].
.SS SEE ALSO
.PP
[rtcSetGeometryBuffer], [rtcSetNewGeometryBuffer]
