1 | // Copyright 2009-2021 Intel Corporation |
2 | // SPDX-License-Identifier: Apache-2.0 |
3 | |
4 | #pragma once |
5 | |
6 | #include "rtcore_common.h" |
7 | |
8 | RTC_NAMESPACE_BEGIN |
9 | |
10 | /* Opaque device type */ |
11 | typedef struct RTCDeviceTy* RTCDevice; |
12 | |
13 | /* Creates a new Embree device. */ |
14 | RTC_API RTCDevice rtcNewDevice(const char* config); |
15 | |
16 | /* Retains the Embree device (increments the reference count). */ |
17 | RTC_API void rtcRetainDevice(RTCDevice device); |
18 | |
19 | /* Releases an Embree device (decrements the reference count). */ |
20 | RTC_API void rtcReleaseDevice(RTCDevice device); |
21 | |
22 | /* Device properties */ |
23 | enum RTCDeviceProperty |
24 | { |
25 | RTC_DEVICE_PROPERTY_VERSION = 0, |
26 | RTC_DEVICE_PROPERTY_VERSION_MAJOR = 1, |
27 | RTC_DEVICE_PROPERTY_VERSION_MINOR = 2, |
28 | RTC_DEVICE_PROPERTY_VERSION_PATCH = 3, |
29 | |
30 | RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED = 32, |
31 | RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED = 33, |
32 | RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED = 34, |
33 | RTC_DEVICE_PROPERTY_RAY_STREAM_SUPPORTED = 35, |
34 | |
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 | |
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_POINT_GEOMETRY_SUPPORTED = 101, |
48 | |
49 | RTC_DEVICE_PROPERTY_TASKING_SYSTEM = 128, |
50 | RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED = 129, |
51 | RTC_DEVICE_PROPERTY_PARALLEL_COMMIT_SUPPORTED = 130 |
52 | }; |
53 | |
54 | /* Gets a device property. */ |
55 | RTC_API ssize_t rtcGetDeviceProperty(RTCDevice device, enum RTCDeviceProperty prop); |
56 | |
57 | /* Sets a device property. */ |
58 | RTC_API void rtcSetDeviceProperty(RTCDevice device, const enum RTCDeviceProperty prop, ssize_t value); |
59 | |
60 | /* Error codes */ |
61 | enum RTCError |
62 | { |
63 | RTC_ERROR_NONE = 0, |
64 | RTC_ERROR_UNKNOWN = 1, |
65 | RTC_ERROR_INVALID_ARGUMENT = 2, |
66 | RTC_ERROR_INVALID_OPERATION = 3, |
67 | RTC_ERROR_OUT_OF_MEMORY = 4, |
68 | RTC_ERROR_UNSUPPORTED_CPU = 5, |
69 | RTC_ERROR_CANCELLED = 6 |
70 | }; |
71 | |
72 | /* Returns the error code. */ |
73 | RTC_API enum RTCError rtcGetDeviceError(RTCDevice device); |
74 | |
75 | /* Error callback function */ |
76 | typedef void (*RTCErrorFunction)(void* userPtr, enum RTCError code, const char* str); |
77 | |
78 | /* Sets the error callback function. */ |
79 | RTC_API void rtcSetDeviceErrorFunction(RTCDevice device, RTCErrorFunction error, void* userPtr); |
80 | |
81 | /* Memory monitor callback function */ |
82 | typedef bool (*RTCMemoryMonitorFunction)(void* ptr, ssize_t bytes, bool post); |
83 | |
84 | /* Sets the memory monitor callback function. */ |
85 | RTC_API void rtcSetDeviceMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunction memoryMonitor, void* userPtr); |
86 | |
87 | RTC_NAMESPACE_END |
88 | |