rtcNewBuffer(3)

πŸ“¦ version 4.4.1, in ubuntu stonking

πŸ’– rtcNewBufferHostDevice β€” from the rtcNewBuffer(3) page ✨

okay bestie, listen. Embree Ray Tracing Kernels 4 has this little cutie called rtcNewBufferHostDevice, and she's the one who makes you a buffer with explicitly managed host and device memory allocations. no cap. let's get into it 🫢


🌸 NAME 🌸

rtcNewBufferHostDevice β€” creates a new data buffer with explicitly managed host and device memory allocations πŸ’…


✨ SYNOPSIS ✨

#include <embree4/rtcore.h>

RTCBuffer rtcNewBufferHostDevice(
  RTCDevice device,
  size_t byteSize
);

πŸ¦‹ DESCRIPTION πŸ¦‹

So basically, rtcNewBufferHostDevice creates a brand new data buffer object of the size you asked for in bytes (that's the byteSize argument, bestie, literally bytes) and it's bound to the device you handed it (the device argument πŸ‘‘).

The buffer object is reference counted, and it starts life with an initial reference count of 1. the way it's main character energy from day one. when you're done with it, the returned buffer object can be released using the rtcReleaseBuffer API call. bye babe πŸ’–

Here's the tea on how the memory actually goes down:

  • If Embree has SYCL support enabled and the SYCL device has no host unified memory (think a discrete GPU, yeah, that one πŸ’€), then the buffer allocates memory on the host and device explicitly.
  • After the buffer is modified on the host, rtcCommitBuffer can be used to synchronize host and device memory by copying the buffer content from the host to device. that's the glow-up, periodt. πŸ”₯
  • If the Embree version has no SYCL support or the SYCL device has host unified memory, then the buffer will behave the same as a buffer created using rtcNewBuffer. same vibe, different function name πŸ™ˆ

Also, the specified number of bytes are allocated at buffer construction time and deallocated when the buffer is destroyed. icon behavior, honestly 🌈


😭 EXIT STATUS 😭

On failure, NULL is returned and an error code is set that can be queried using rtcGetDeviceError. so if you get nothing back, go check that error code, bestie, don't just sit there πŸ’€


πŸ‘‘ SEE ALSO πŸ‘‘

  • rtcCommitBuffer
  • rtcNewBuffer
  • rtcRetainBuffer
  • rtcReleaseBuffer

go read those too. they're all connected, iykyk 🧚

and that's the whole page, fr fr πŸŽ€ this was rtcNewBufferHostDevice, hanging out in the Embree Ray Tracing Kernels 4 era, sitting pretty on the rtcNewBuffer(3) page. mwah, go write some ray tracing code, you got this πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from