rtcSetSha...tryBuffer(3)

πŸ“¦ version 3.13.5, in epel 9, fedora 43, fedora 44

πŸ’– 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 byteOffset argument
  • the byte stride between individual buffer elements β€” that's the byteStride argument
  • the format of the buffer elements β€” that's the format argument
  • and the number of elements to bind β€” that's the itemCount
⚠️ okay this part matters, listen up: the start address (byteOffset argument) and the stride (byteStride argument) must both be aligned to 4 bytes. if they're not, the rtcSetSharedGeometryBuffer function 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