RTCSETDEVICEERRORFUNCTION(3embree4)

✨ rtcSetDeviceErrorFunction ✨

okay bestie, welcome to the Embree Ray Tracing Kernels 4 manual page for rtcSetDeviceErrorFunction β€” yes the title up top is squished all ugly like rtcSetDev...orFunction(3) but that's just the manpage being dramatic, the real name is right there πŸ’…


🌸 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 πŸ’–

so with the rtcSetDeviceErrorFunction call, you can set a callback function (that's the error argument) plus a little payload for it (that's the userPtr argument) 🫢 and that callback gets called whenever an error happens for the device you named (the device argument). no cap.

here's the tea tho β€” you get one single callback function per device. that's it. one. so if you call this again, the new one just overwrites the one you set before, no warning, no merge, it's giving replacement. and if you pass NULL as the function pointer, that disables the registered callback function entirely πŸ™ˆ bye bestie.

when your registered callback function actually gets invoked, it's handed:

  • the user-defined payload β€” that's the userPtr argument, exactly as you specified it at registration time
  • the error code β€” that's the code argument, for the error that occurred
  • a string β€” that's the str argument, which further describes the error πŸ“

and one more thing: the error code is also set if an error callback function is registered. so even with your cute callback in place, the error code still gets set. periodt.


πŸ’€ EXIT STATUS πŸ’€

if it fails, an error code is set, and you can go query it using rtcGetDeviceError. so like, go check it πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹

  • [rtcGetDeviceError]

okay that's the whole page, you ate it 🌈 this was the rtcSetDev...orFunction(3) page from Embree Ray Tracing Kernels 4 β€” and ngl there's no date stamped anywhere on this one, the footer is just the same truncated title again, so like... timeless icon behaviour βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from