rtcore_device.isph 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // ======================================================================== //
  2. // Copyright 2009-2018 Intel Corporation //
  3. // //
  4. // Licensed under the Apache License, Version 2.0 (the "License"); //
  5. // you may not use this file except in compliance with the License. //
  6. // You may obtain a copy of the License at //
  7. // //
  8. // http://www.apache.org/licenses/LICENSE-2.0 //
  9. // //
  10. // Unless required by applicable law or agreed to in writing, software //
  11. // distributed under the License is distributed on an "AS IS" BASIS, //
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
  13. // See the License for the specific language governing permissions and //
  14. // limitations under the License. //
  15. // ======================================================================== //
  16. #ifndef __RTC_DEVICE_ISPH__
  17. #define __RTC_DEVICE_ISPH__
  18. #include "rtcore_common.isph"
  19. /* Opaque device type */
  20. typedef uniform struct RTCDeviceTy* uniform RTCDevice;
  21. /* Creates a new Embree device. */
  22. RTC_API RTCDevice rtcNewDevice(const uniform int8* uniform config);
  23. /* Retains the Embree device (increments the reference count). */
  24. RTC_API void rtcRetainDevice(RTCDevice device);
  25. /* Releases an Embree device (decrements the reference count). */
  26. RTC_API void rtcReleaseDevice(RTCDevice device);
  27. /* Device properties */
  28. enum RTCDeviceProperty
  29. {
  30. RTC_DEVICE_PROPERTY_VERSION = 0,
  31. RTC_DEVICE_PROPERTY_VERSION_MAJOR = 1,
  32. RTC_DEVICE_PROPERTY_VERSION_MINOR = 2,
  33. RTC_DEVICE_PROPERTY_VERSION_PATCH = 3,
  34. RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED = 32,
  35. RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED = 33,
  36. RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED = 34,
  37. RTC_DEVICE_PROPERTY_RAY_STREAM_SUPPORTED = 35,
  38. RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED = 64,
  39. RTC_DEVICE_PROPERTY_BACKFACE_CULLING_ENABLED = 65,
  40. RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED = 66,
  41. RTC_DEVICE_PROPERTY_IGNORE_INVALID_RAYS_ENABLED = 67,
  42. RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED = 96,
  43. RTC_DEVICE_PROPERTY_QUAD_GEOMETRY_SUPPORTED = 97,
  44. RTC_DEVICE_PROPERTY_SUBDIVISION_GEOMETRY_SUPPORTED = 98,
  45. RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED = 99,
  46. RTC_DEVICE_PROPERTY_USER_GEOMETRY_SUPPORTED = 100,
  47. RTC_DEVICE_PROPERTY_TASKING_SYSTEM = 128,
  48. RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED = 129
  49. };
  50. /* Gets a device property. */
  51. RTC_API uniform intptr_t rtcGetDeviceProperty(RTCDevice device, uniform RTCDeviceProperty prop);
  52. /* Sets a device property. */
  53. RTC_API void rtcSetDeviceProperty(RTCDevice device, const uniform RTCDeviceProperty prop, uniform intptr_t value);
  54. /* Error codes */
  55. enum RTCError
  56. {
  57. RTC_ERROR_NONE = 0,
  58. RTC_ERROR_UNKNOWN = 1,
  59. RTC_ERROR_INVALID_ARGUMENT = 2,
  60. RTC_ERROR_INVALID_OPERATION = 3,
  61. RTC_ERROR_OUT_OF_MEMORY = 4,
  62. RTC_ERROR_UNSUPPORTED_CPU = 5,
  63. RTC_ERROR_CANCELLED = 6
  64. };
  65. /* Returns the error code. */
  66. RTC_API uniform RTCError rtcGetDeviceError(RTCDevice device);
  67. /* Error callback function */
  68. typedef unmasked void (*uniform RTCErrorFunction)(void* uniform userPtr, uniform RTCError code, const uniform int8* uniform str);
  69. /* Sets the error callback function. */
  70. RTC_API void rtcSetDeviceErrorFunction(RTCDevice device, uniform RTCErrorFunction error, void* uniform userPtr);
  71. /* Memory monitor callback function */
  72. typedef uniform bool (*uniform RTCMemoryMonitorFunction)(uniform intptr_t bytes, uniform bool post);
  73. /* Sets the memory monitor callback function. */
  74. RTC_API void rtcSetDeviceMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunction memoryMonitor, void* uniform userPtr);
  75. #endif