Path: blob/master/thirdparty/embree/include/embree4/rtcore_device.h
9905 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "rtcore_common.h"67RTC_NAMESPACE_BEGIN89/* Opaque device type */10typedef struct RTCDeviceTy* RTCDevice;11typedef struct RTCSceneTy* RTCScene;1213/* Creates a new Embree device. */14RTC_API RTCDevice rtcNewDevice(const char* config);1516#if defined(EMBREE_SYCL_SUPPORT) && defined(SYCL_LANGUAGE_VERSION)1718/*19Creates a new Embree SYCL device. It will internally select the first SYCL device of20the SYCL context as the default device for memory allocations. You can set a specific21SYCL device that's part of the SYCL context by calling rtcSetDeviceSYCLDevice.22*/23RTC_API_EXTERN_C RTCDevice rtcNewSYCLDevice(sycl::context context, const char* config);2425/* Checks if SYCL device is supported by Embree. */26RTC_API bool rtcIsSYCLDeviceSupported(const sycl::device sycl_device);2728/* SYCL selector for Embree supported devices */29RTC_API int rtcSYCLDeviceSelector(const sycl::device sycl_device);3031/* Set the SYCL device to be used to allocate data */32RTC_API void rtcSetDeviceSYCLDevice(RTCDevice device, const sycl::device sycl_device);3334/* rtcCommitSceneWithQueue is asynchronous, user has to call queue.wait()35for synchronization. rtcCommitScene is blocking. */36RTC_API_CPP sycl::event rtcCommitSceneWithQueue(RTCScene scene, sycl::queue queue);3738#endif394041/* Retains the Embree device (increments the reference count). */42RTC_API void rtcRetainDevice(RTCDevice device);4344/* Releases an Embree device (decrements the reference count). */45RTC_API void rtcReleaseDevice(RTCDevice device);4647/* Device properties */48enum RTCDeviceProperty49{50RTC_DEVICE_PROPERTY_VERSION = 0,51RTC_DEVICE_PROPERTY_VERSION_MAJOR = 1,52RTC_DEVICE_PROPERTY_VERSION_MINOR = 2,53RTC_DEVICE_PROPERTY_VERSION_PATCH = 3,5455RTC_DEVICE_PROPERTY_NATIVE_RAY4_SUPPORTED = 32,56RTC_DEVICE_PROPERTY_NATIVE_RAY8_SUPPORTED = 33,57RTC_DEVICE_PROPERTY_NATIVE_RAY16_SUPPORTED = 34,5859RTC_DEVICE_PROPERTY_BACKFACE_CULLING_SPHERES_ENABLED = 62,60RTC_DEVICE_PROPERTY_BACKFACE_CULLING_CURVES_ENABLED = 63,61RTC_DEVICE_PROPERTY_RAY_MASK_SUPPORTED = 64,62RTC_DEVICE_PROPERTY_BACKFACE_CULLING_ENABLED = 65,63RTC_DEVICE_PROPERTY_FILTER_FUNCTION_SUPPORTED = 66,64RTC_DEVICE_PROPERTY_IGNORE_INVALID_RAYS_ENABLED = 67,65RTC_DEVICE_PROPERTY_COMPACT_POLYS_ENABLED = 68,6667RTC_DEVICE_PROPERTY_TRIANGLE_GEOMETRY_SUPPORTED = 96,68RTC_DEVICE_PROPERTY_QUAD_GEOMETRY_SUPPORTED = 97,69RTC_DEVICE_PROPERTY_SUBDIVISION_GEOMETRY_SUPPORTED = 98,70RTC_DEVICE_PROPERTY_CURVE_GEOMETRY_SUPPORTED = 99,71RTC_DEVICE_PROPERTY_USER_GEOMETRY_SUPPORTED = 100,72RTC_DEVICE_PROPERTY_POINT_GEOMETRY_SUPPORTED = 101,7374RTC_DEVICE_PROPERTY_TASKING_SYSTEM = 128,75RTC_DEVICE_PROPERTY_JOIN_COMMIT_SUPPORTED = 129,76RTC_DEVICE_PROPERTY_PARALLEL_COMMIT_SUPPORTED = 130,7778RTC_DEVICE_PROPERTY_CPU_DEVICE = 140,79RTC_DEVICE_PROPERTY_SYCL_DEVICE = 14180};8182/* Gets a device property. */83RTC_API ssize_t rtcGetDeviceProperty(RTCDevice device, enum RTCDeviceProperty prop);8485/* Sets a device property. */86RTC_API void rtcSetDeviceProperty(RTCDevice device, const enum RTCDeviceProperty prop, ssize_t value);8788/* Error codes */89enum RTCError90{91RTC_ERROR_NONE = 0,92RTC_ERROR_UNKNOWN = 1,93RTC_ERROR_INVALID_ARGUMENT = 2,94RTC_ERROR_INVALID_OPERATION = 3,95RTC_ERROR_OUT_OF_MEMORY = 4,96RTC_ERROR_UNSUPPORTED_CPU = 5,97RTC_ERROR_CANCELLED = 6,98RTC_ERROR_LEVEL_ZERO_RAYTRACING_SUPPORT_MISSING = 7,99};100101/* Returns the string representation for the error code. For example, for RTC_ERROR_UNKNOWN the string "RTC_ERROR_UNKNOWN" will be returned. */102RTC_API const char* rtcGetErrorString(enum RTCError error);103104/* Returns the error code. */105RTC_API enum RTCError rtcGetDeviceError(RTCDevice device);106107/* Returns a message corresponding to the last error code (returned by rtcGetDeviceError) which provides details about the error that happened.108The same message will be written to console when verbosity is > 0 or when an error callback function is set for the device.109However, when device creation itself fails this is the only way to get additional information about the error. */110RTC_API const char* rtcGetDeviceLastErrorMessage(RTCDevice device);111112/* Error callback function */113typedef void (*RTCErrorFunction)(void* userPtr, enum RTCError code, const char* str);114115/* Sets the error callback function. */116RTC_API void rtcSetDeviceErrorFunction(RTCDevice device, RTCErrorFunction error, void* userPtr);117118/* Memory monitor callback function */119typedef bool (*RTCMemoryMonitorFunction)(void* ptr, ssize_t bytes, bool post);120121/* Sets the memory monitor callback function. */122RTC_API void rtcSetDeviceMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunction memoryMonitor, void* userPtr);123124RTC_NAMESPACE_END125126127