rtcore_device.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // Copyright 2009-2021 Intel Corporation
  2. // SPDX-License-Identifier: Apache-2.0
  3. #pragma once
  4. #include "rtcore_common.h"
  5. RTC_NAMESPACE_BEGIN
  6. /* Opaque device type */
  7. typedef struct RTCDeviceTy* RTCDevice;
  8. /* Creates a new Embree device. */
  9. RTC_API RTCDevice rtcNewDevice(const char* config);
  10. #if defined(EMBREE_SYCL_SUPPORT) && defined(SYCL_LANGUAGE_VERSION)
  11. /* Creates a new Embree SYCL device. */
  12. RTC_API_EXTERN_C RTCDevice rtcNewSYCLDevice(sycl::context context, const char* config);
  13. /* Checks if SYCL device is supported by Embree. */
  14. RTC_API bool rtcIsSYCLDeviceSupported(const sycl::device sycl_device);
  15. /* SYCL selector for Embree supported devices */
  16. RTC_API int rtcSYCLDeviceSelector(const sycl::device sycl_device);
  17. /* Set the SYCL device to be used to allocate data */
  18. RTC_API void rtcSetDeviceSYCLDevice(RTCDevice device, const sycl::device sycl_device);
  19. #endif
  20. /* Retains the Embree device (increments the reference count). */
  21. RTC_API void rtcRetainDevice(RTCDevice device);
  22. /* Releases an Embree device (decrements the reference count). */
  23. RTC_API void rtcReleaseDevice(RTCDevice device);
  24. /* Device properties */
  25. enum RTCDeviceProperty
  26. {
  27. RTC_DEVICE_PROPERTY_VERSION = 0,
  28. RTC_DEVICE_PROPERTY_VERSION_MAJOR = 1,
  29. RTC_DEVICE_PROPERTY_VERSION_MINOR = 2,
  30. RTC_DEVICE_PROPERTY_VERSION_PATCH = 3,
  31. RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED = 32,
  32. RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED = 33,
  33. RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED = 34,
  34. RTC_DEVICE_PROPERTY_BACKFACE_CULLING_SPHERES_ENABLED = 62,
  35. RTC_DEVICE_PROPERTY_BACKFACE_CULLING_CURVES_ENABLED = 63,
  36. RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED = 64,
  37. RTC_DEVICE_PROPERTY_BACKFACE_CULLING_ENABLED = 65,
  38. RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED = 66,
  39. RTC_DEVICE_PROPERTY_IGNORE_INVALID_RAYS_ENABLED = 67,
  40. RTC_DEVICE_PROPERTY_COMPACT_POLYS_ENABLED = 68,
  41. RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED = 96,
  42. RTC_DEVICE_PROPERTY_QUAD_GEOMETRY_SUPPORTED = 97,
  43. RTC_DEVICE_PROPERTY_SUBDIVISION_GEOMETRY_SUPPORTED = 98,
  44. RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED = 99,
  45. RTC_DEVICE_PROPERTY_USER_GEOMETRY_SUPPORTED = 100,
  46. RTC_DEVICE_PROPERTY_POINT_GEOMETRY_SUPPORTED = 101,
  47. RTC_DEVICE_PROPERTY_TASKING_SYSTEM = 128,
  48. RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED = 129,
  49. RTC_DEVICE_PROPERTY_PARALLEL_COMMIT_SUPPORTED = 130
  50. };
  51. /* Gets a device property. */
  52. RTC_API ssize_t rtcGetDeviceProperty(RTCDevice device, enum RTCDeviceProperty prop);
  53. /* Sets a device property. */
  54. RTC_API void rtcSetDeviceProperty(RTCDevice device, const enum RTCDeviceProperty prop, ssize_t value);
  55. /* Error codes */
  56. enum RTCError
  57. {
  58. RTC_ERROR_NONE = 0,
  59. RTC_ERROR_UNKNOWN = 1,
  60. RTC_ERROR_INVALID_ARGUMENT = 2,
  61. RTC_ERROR_INVALID_OPERATION = 3,
  62. RTC_ERROR_OUT_OF_MEMORY = 4,
  63. RTC_ERROR_UNSUPPORTED_CPU = 5,
  64. RTC_ERROR_CANCELLED = 6,
  65. };
  66. /* Returns the error code. */
  67. RTC_API enum RTCError rtcGetDeviceError(RTCDevice device);
  68. /* Error callback function */
  69. typedef void (*RTCErrorFunction)(void* userPtr, enum RTCError code, const char* str);
  70. /* Sets the error callback function. */
  71. RTC_API void rtcSetDeviceErrorFunction(RTCDevice device, RTCErrorFunction error, void* userPtr);
  72. /* Memory monitor callback function */
  73. typedef bool (*RTCMemoryMonitorFunction)(void* ptr, ssize_t bytes, bool post);
  74. /* Sets the memory monitor callback function. */
  75. RTC_API void rtcSetDeviceMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunction memoryMonitor, void* userPtr);
  76. RTC_NAMESPACE_END