Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/embree/include/embree4/rtcore_device.h
9905 views
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
typedef struct RTCSceneTy* RTCScene;
13
14
/* Creates a new Embree device. */
15
RTC_API RTCDevice rtcNewDevice(const char* config);
16
17
#if defined(EMBREE_SYCL_SUPPORT) && defined(SYCL_LANGUAGE_VERSION)
18
19
/*
20
Creates a new Embree SYCL device. It will internally select the first SYCL device of
21
the SYCL context as the default device for memory allocations. You can set a specific
22
SYCL device that's part of the SYCL context by calling rtcSetDeviceSYCLDevice.
23
*/
24
RTC_API_EXTERN_C RTCDevice rtcNewSYCLDevice(sycl::context context, const char* config);
25
26
/* Checks if SYCL device is supported by Embree. */
27
RTC_API bool rtcIsSYCLDeviceSupported(const sycl::device sycl_device);
28
29
/* SYCL selector for Embree supported devices */
30
RTC_API int rtcSYCLDeviceSelector(const sycl::device sycl_device);
31
32
/* Set the SYCL device to be used to allocate data */
33
RTC_API void rtcSetDeviceSYCLDevice(RTCDevice device, const sycl::device sycl_device);
34
35
/* rtcCommitSceneWithQueue is asynchronous, user has to call queue.wait()
36
for synchronization. rtcCommitScene is blocking. */
37
RTC_API_CPP sycl::event rtcCommitSceneWithQueue(RTCScene scene, sycl::queue queue);
38
39
#endif
40
41
42
/* Retains the Embree device (increments the reference count). */
43
RTC_API void rtcRetainDevice(RTCDevice device);
44
45
/* Releases an Embree device (decrements the reference count). */
46
RTC_API void rtcReleaseDevice(RTCDevice device);
47
48
/* Device properties */
49
enum RTCDeviceProperty
50
{
51
RTC_DEVICE_PROPERTY_VERSION = 0,
52
RTC_DEVICE_PROPERTY_VERSION_MAJOR = 1,
53
RTC_DEVICE_PROPERTY_VERSION_MINOR = 2,
54
RTC_DEVICE_PROPERTY_VERSION_PATCH = 3,
55
56
RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED = 32,
57
RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED = 33,
58
RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED = 34,
59
60
RTC_DEVICE_PROPERTY_BACKFACE_CULLING_SPHERES_ENABLED = 62,
61
RTC_DEVICE_PROPERTY_BACKFACE_CULLING_CURVES_ENABLED = 63,
62
RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED = 64,
63
RTC_DEVICE_PROPERTY_BACKFACE_CULLING_ENABLED = 65,
64
RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED = 66,
65
RTC_DEVICE_PROPERTY_IGNORE_INVALID_RAYS_ENABLED = 67,
66
RTC_DEVICE_PROPERTY_COMPACT_POLYS_ENABLED = 68,
67
68
RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED = 96,
69
RTC_DEVICE_PROPERTY_QUAD_GEOMETRY_SUPPORTED = 97,
70
RTC_DEVICE_PROPERTY_SUBDIVISION_GEOMETRY_SUPPORTED = 98,
71
RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED = 99,
72
RTC_DEVICE_PROPERTY_USER_GEOMETRY_SUPPORTED = 100,
73
RTC_DEVICE_PROPERTY_POINT_GEOMETRY_SUPPORTED = 101,
74
75
RTC_DEVICE_PROPERTY_TASKING_SYSTEM = 128,
76
RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED = 129,
77
RTC_DEVICE_PROPERTY_PARALLEL_COMMIT_SUPPORTED = 130,
78
79
RTC_DEVICE_PROPERTY_CPU_DEVICE = 140,
80
RTC_DEVICE_PROPERTY_SYCL_DEVICE = 141
81
};
82
83
/* Gets a device property. */
84
RTC_API ssize_t rtcGetDeviceProperty(RTCDevice device, enum RTCDeviceProperty prop);
85
86
/* Sets a device property. */
87
RTC_API void rtcSetDeviceProperty(RTCDevice device, const enum RTCDeviceProperty prop, ssize_t value);
88
89
/* Error codes */
90
enum RTCError
91
{
92
RTC_ERROR_NONE = 0,
93
RTC_ERROR_UNKNOWN = 1,
94
RTC_ERROR_INVALID_ARGUMENT = 2,
95
RTC_ERROR_INVALID_OPERATION = 3,
96
RTC_ERROR_OUT_OF_MEMORY = 4,
97
RTC_ERROR_UNSUPPORTED_CPU = 5,
98
RTC_ERROR_CANCELLED = 6,
99
RTC_ERROR_LEVEL_ZERO_RAYTRACING_SUPPORT_MISSING = 7,
100
};
101
102
/* Returns the string representation for the error code. For example, for RTC_ERROR_UNKNOWN the string "RTC_ERROR_UNKNOWN" will be returned. */
103
RTC_API const char* rtcGetErrorString(enum RTCError error);
104
105
/* Returns the error code. */
106
RTC_API enum RTCError rtcGetDeviceError(RTCDevice device);
107
108
/* Returns a message corresponding to the last error code (returned by rtcGetDeviceError) which provides details about the error that happened.
109
The same message will be written to console when verbosity is > 0 or when an error callback function is set for the device.
110
However, when device creation itself fails this is the only way to get additional information about the error. */
111
RTC_API const char* rtcGetDeviceLastErrorMessage(RTCDevice device);
112
113
/* Error callback function */
114
typedef void (*RTCErrorFunction)(void* userPtr, enum RTCError code, const char* str);
115
116
/* Sets the error callback function. */
117
RTC_API void rtcSetDeviceErrorFunction(RTCDevice device, RTCErrorFunction error, void* userPtr);
118
119
/* Memory monitor callback function */
120
typedef bool (*RTCMemoryMonitorFunction)(void* ptr, ssize_t bytes, bool post);
121
122
/* Sets the memory monitor callback function. */
123
RTC_API void rtcSetDeviceMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunction memoryMonitor, void* userPtr);
124
125
RTC_NAMESPACE_END
126
127