rtcSetSha...tryBuffer(3)
π rtcSetSharedGeometryBuffer β from the rtcSetSha...tryBuffer(3) page in the Embree Ray Tracing Kernels 3 manual π
okay bestie, gather round, because this one is genuinely a glow-up for your memory usage β¨
β¨ NAME β¨
rtcSetSharedGeometryBuffer β assigns a view of a shared data buffer to a geometry π«Ά
like. it does not own the buffer. it just points at yours. very "we're not dating, we're just vibing" of it π
πΈ SYNOPSIS πΈ
#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
);
look at those args. iconic. no cap. π
π¦ DESCRIPTION π¦
so the rtcSetSharedGeometryBuffer function binds a view of a shared, user-managed data buffer (that's the ptr argument, bestie β your buffer, not Embree's) to a geometry buffer type and slot (those are the type and slot arguments) of the geometry you picked (the geometry argument). it's giving "here, look at my stuff, don't touch it" π
you get to be extremely specific about the vibes, too:
- you can specify the start of the first buffer element in bytes β that's the
byteOffsetargument - the byte stride between individual buffer elements β that's the
byteStrideargument - the format of the buffer elements β that's the
formatargument - and the number of elements to bind β that's the
itemCount
β οΈ okay this part matters, listen up: the start address (byteOffsetargument) and the stride (byteStrideargument) must both be aligned to 4 bytes. if they're not, thertcSetSharedGeometryBufferfunction will fail. no soft launch, no warning shot, just fail π
and here's the situationship clause: 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. that's you. you're the user. it's you π«΅
sharing buffers can significantly reduce the memory required by the application, so honestly? we recommend using this feature. fr fr. π
and it gets better: when you enable the RTC_SCENE_FLAG_COMPACT scene flag, the spatial index structures index into the vertex buffer, which results in even higher memory savings. the way that just keeps giving β¨π₯
π EXIT STATUS π
on failure, an error code is set, and you can go query it with rtcGetDeviceError. lowkey your bestie for debugging π
π SEE ALSO π
- [
rtcSetGeometryBuffer] - [
rtcSetNewGeometryBuffer]
go read those too, i'm obsessed with a complete education π
and that's the whole page, bestie π§ this was the rtcSetSha...tryBuffer(3) page from the Embree Ray Tracing Kernels 3 manual, and yeah, the name got truncated on the header and footer because manpage titles have a character budget and honestly? relatable. slay, stay aligned to 4 bytes, and hydrate π
π¦ where this page comes from
- epel 9: embree 3.13.5-4.el9 Β· Apache-2.0
- fedora 43: embree3 3.13.5-9.fc41 Β· Apache-2.0
- fedora 44: embree3 3.13.5-16.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms