| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- // ======================================================================== //
- // Copyright 2009-2017 Intel Corporation //
- // //
- // Licensed under the Apache License, Version 2.0 (the "License"); //
- // you may not use this file except in compliance with the License. //
- // You may obtain a copy of the License at //
- // //
- // http://www.apache.org/licenses/LICENSE-2.0 //
- // //
- // Unless required by applicable law or agreed to in writing, software //
- // distributed under the License is distributed on an "AS IS" BASIS, //
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
- // See the License for the specific language governing permissions and //
- // limitations under the License. //
- // ======================================================================== //
- #ifndef __RTCORE_ISPH__
- #define __RTCORE_ISPH__
- #if !defined(RTCORE_API)
- #define RTCORE_API extern "C" unmasked
- #endif
- #ifdef _WIN32
- # define RTCORE_ALIGN(...) // FIXME: need to specify alignment
- #else
- # define RTCORE_ALIGN(...) // FIXME: need to specify alignment
- #endif
- #if !defined(RTCORE_DEPRECATED)
- #define RTCORE_DEPRECATED // FIXME: deprecation not supported by ISPC
- #endif
- /*! Embree API version */
- #define RTCORE_VERSION_MAJOR @EMBREE_VERSION_MAJOR@
- #define RTCORE_VERSION_MINOR @EMBREE_VERSION_MINOR@
- #define RTCORE_VERSION_PATCH @EMBREE_VERSION_PATCH@
- #define RTCORE_VERSION @EMBREE_VERSION_NUMBER@
- /*! \file rtcore.isph Defines the Embree Ray Tracing Kernel API for ISPC.
- This file defines the Embree ray tracing kernel API for C and
- C++. The user is supposed to include this file, and alternatively
- the rtcore_ray.isph file, but none of the other .isph files in this
- folder. */
- /*! \{ */
- /*! Axis aligned bounding box representation */
- RTCORE_ALIGN(16) struct RTCBounds
- {
- float lower_x, lower_y, lower_z, align0;
- float upper_x, upper_y, upper_z, align1;
- };
- /*! \brief Defines an opaque device type */
- typedef uniform struct __RTCDevice {}* uniform RTCDevice;
- /*! \brief Creates a new Embree device.
- Creates a new Embree device to be used by the application. An
- application typically creates only a single Embree device, but it is
- valid to use multiple devices inside an application. A configuration
- string can be passed at construction time, that allows to configure
- implementation specific parameters. If this string is NULL, a
- default configuration is used. The following configuration flags are
- supported by the Embree implementation of the API:
-
- verbose = num, // sets verbosity level (default is 0)
- If Embree is started on an unsupported CPU, rtcNewDevice will fail and
- set the RTC_UNSUPPORTED_CPU error code.
-
- */
- RTCDevice rtcNewDevice(const uniform int8* uniform cfg = NULL);
- /*! \brief Deletes an Embree device.
- Deletes the Embree device again. After deletion, all scene handles
- are invalid. */
- void rtcDeleteDevice(RTCDevice device);
- /*! \brief Initializes the Embree ray tracing core
- WARNING: This function is deprecated, use rtcNewDevice instead.
- Initializes the ray tracing core and passes some configuration
- string. The configuration string allows to configure implementation
- specific parameters. If this string is NULL, a default configuration
- is used. The following configuration flags are supported by the
- Embree implementation of the API:
-
- verbose = num, // sets verbosity level (default is 0)
- If Embree is started on an unsupported CPU, rtcInit will fail and
- set the RTC_UNSUPPORTED_CPU error code.
-
- */
- RTCORE_DEPRECATED void rtcInit(const uniform int8* uniform cfg = NULL);
- /*! \brief Shuts down Embree.
- WARNING: This function is deprecated, use rtcDeleteDevice instead.
- Shuts down the ray tracing core. After shutdown, all scene handles
- are invalid, and invoking any API call except rtcInit is not
- allowed. The application should invoke this call before
- terminating. It is safe to call rtcInit again after an rtcExit
- call. */
- RTCORE_DEPRECATED void rtcExit();
- /*! \brief Parameters that can get configured using the rtcSetParameter functions. */
- enum RTCParameter {
- RTC_SOFTWARE_CACHE_SIZE = 0, /*! Configures the software cache size (used
- to cache subdivision surfaces for
- instance). The size is specified as an
- integer number of bytes. The software
- cache cannot be configured during
- rendering. (write only) */
- RTC_CONFIG_INTERSECT1 = 1, //!< checks if rtcIntersect1 is supported (read only)
- RTC_CONFIG_INTERSECT4 = 2, //!< checks if rtcIntersect4 is supported (read only)
- RTC_CONFIG_INTERSECT8 = 3, //!< checks if rtcIntersect8 is supported (read only)
- RTC_CONFIG_INTERSECT16 = 4, //!< checks if rtcIntersect16 is supported (read only)
- RTC_CONFIG_INTERSECT_STREAM = 5, //!< checks if rtcIntersect1M, rtcIntersectVM, rtcIntersectNM and rtcIntersectNp are supported (read only)
- RTC_CONFIG_RAY_MASK = 6, //!< checks if ray masks are supported (read only)
- RTC_CONFIG_BACKFACE_CULLING = 7, //!< checks if backface culling is supported (read only)
- RTC_CONFIG_INTERSECTION_FILTER = 8, //!< checks if intersection filters are enabled (read only)
- RTC_CONFIG_INTERSECTION_FILTER_RESTORE = 9, //!< checks if intersection filters restores previous hit (read only)
- RTC_CONFIG_IGNORE_INVALID_RAYS = 11, //!< checks if invalid rays are ignored (read only)
- RTC_CONFIG_TASKING_SYSTEM = 12, //!< return used tasking system (0 = INTERNAL, 1 = TBB) (read only)
-
- RTC_CONFIG_VERSION_MAJOR = 13, //!< returns Embree major version (read only)
- RTC_CONFIG_VERSION_MINOR = 14, //!< returns Embree minor version (read only)
- RTC_CONFIG_VERSION_PATCH = 15, //!< returns Embree patch version (read only)
- RTC_CONFIG_VERSION = 16, //!< returns Embree version as integer (e.g. Embree v2.8.2 -> 20802) (read only)
- RTC_CONFIG_TRIANGLE_GEOMETRY = 17, //!< checks if triangle geometries are supported
- RTC_CONFIG_QUAD_GEOMETRY = 18, //!< checks if quad geometries are supported
- RTC_CONFIG_LINE_GEOMETRY = 19, //!< checks if line geometries are supported
- RTC_CONFIG_HAIR_GEOMETRY = 20, //!< checks if hair geometries are supported
- RTC_CONFIG_SUBDIV_GEOMETRY = 21, //!< checks if subdiv geometries are supported
- RTC_CONFIG_USER_GEOMETRY = 22, //!< checks if user geometries are supported
- RTC_CONFIG_COMMIT_JOIN = 23, //!< checks if rtcCommitJoin can be used to join build operation (not supported when compiled with some older TBB versions)
- RTC_CONFIG_COMMIT_THREAD = 24, //!< checks if rtcCommitThread is available (not supported when compiled with some older TBB versions)
- };
- /*! \brief Configures some parameters.
- WARNING: This function is deprecated, use rtcDeviceSetParameter1i instead.
- */
- RTCORE_DEPRECATED void rtcSetParameter1i(const uniform RTCParameter parm, uniform size_t val); // FIXME: should be ssize_t
- /*! \brief Reads some parameters.
- WARNING: This function is deprecated, use rtcDeviceGetParameter1i instead.
- */
- uniform size_t rtcGetParameter1i(const uniform RTCParameter parm); // FIXME: should return ssize_t
- /*! \brief Configures some device parameters.*/
- void rtcDeviceSetParameter1i(RTCDevice device, const uniform RTCParameter parm, uniform size_t val); // FIXME: should be ssize_t
- /*! \brief Reads some device parameters. */
- uniform size_t rtcDeviceGetParameter1i(RTCDevice device, const uniform RTCParameter parm); // FIXME: should return ssize_t
- /*! \brief Error codes returned by the rtcGetError function. */
- enum RTCError {
- RTC_NO_ERROR = 0, //!< No error has been recorded.
- RTC_UNKNOWN_ERROR = 1, //!< An unknown error has occured.
- RTC_INVALID_ARGUMENT = 2, //!< An invalid argument is specified
- RTC_INVALID_OPERATION = 3, //!< The operation is not allowed for the specified object.
- RTC_OUT_OF_MEMORY = 4, //!< There is not enough memory left to execute the command.
- RTC_UNSUPPORTED_CPU = 5, //!< The CPU is not supported as it does not support SSE2.
- RTC_CANCELLED = 6 //!< The user has cancelled the operation through the RTCProgressMonitorFunc callback
- };
- /*! \brief Returns the value of the per-thread error flag.
- WARNING: This function is deprecated, use rtcDeviceGetError instead.
- If an error occurs this flag is set to an error code if it stores no
- previous error. The rtcGetError function reads and returns the
- currently stored error and clears the error flag again. */
- RTCORE_DEPRECATED uniform RTCError rtcGetError();
- /*! \brief Returns the value of the per-thread error flag.
- If an error occurs this flag is set to an error code if it stores no
- previous error. The rtcGetError function reads and returns the
- currently stored error and clears the error flag again. */
- uniform RTCError rtcDeviceGetError(RTCDevice device);
- /*! \brief Type of error callback function.
- WARNING: This callback function is deprecated, use RTCErrorFunc2 instead.
- */
- RTCORE_DEPRECATED typedef unmasked void (*uniform RTCErrorFunc)(const uniform RTCError code, const uniform int8* uniform str);
- RTCORE_DEPRECATED typedef RTCErrorFunc RTC_ERROR_FUNCTION;
- /*! \brief Type of error callback function. */
- typedef unmasked void (*uniform RTCErrorFunc2)(void* uniform userPtr, const uniform RTCError code, const uniform int8* uniform str);
- /*! \brief Sets a callback function that is called whenever an error occurs.
- WARNING: This function is deprecated, use rtcDeviceSetErrorFunction2 instead.
- */
- RTCORE_DEPRECATED void rtcSetErrorFunction(uniform RTCErrorFunc func);
- /*! \brief Sets a callback function that is called whenever an error occurs.
- WARNING: This function is deprecated, use rtcDeviceSetErrorFunction2 instead.
- */
- RTCORE_DEPRECATED void rtcDeviceSetErrorFunction(RTCDevice device, uniform RTCErrorFunc func);
- /*! \brief Sets a callback function that is called whenever an error occurs. */
- void rtcDeviceSetErrorFunction2(RTCDevice device, uniform RTCErrorFunc2 func, void* uniform userPtr);
- /*! \brief Type of memory consumption callback function.
- WARNING: This callback function is deprecated, use RTCMemoryMonitorFunc2 instead.
- */
- RTCORE_DEPRECATED typedef uniform bool (*uniform RTCMemoryMonitorFunc)(const uniform size_t bytes, const uniform bool post); // FIXME: should be ssize_t
- RTCORE_DEPRECATED typedef RTCMemoryMonitorFunc RTC_MEMORY_MONITOR_FUNCTION;
- /*! \brief Type of memory consumption callback function. */
- typedef uniform bool (*uniform RTCMemoryMonitorFunc2)(const uniform size_t bytes, const uniform bool post); // FIXME: should be ssize_t
- /*! \brief Sets the memory consumption callback function which is
- * called before the library allocates or after the library frees
- * memory.
- * WARNING: This function is deprecated, use rtcDeviceSetMemoryMonitorFunction2 instead.
- */
- RTCORE_DEPRECATED void rtcSetMemoryMonitorFunction(RTCMemoryMonitorFunc func);
- /*! \brief Sets the memory consumption callback function which is
- * called before the library allocates or after the library frees
- * memory.
- WARNING: This function is deprecated, use rtcDeviceSetMemoryMonitorFunction2 instead.
- */
- void rtcDeviceSetMemoryMonitorFunction(RTCDevice device, RTCMemoryMonitorFunc func);
- /*! \brief Sets the memory consumption callback function which is
- * called before or after the library allocates or frees memory. The
- * userPtr pointer is passed to each invokation of the callback
- * function. */
- void rtcDeviceSetMemoryMonitorFunction2(RTCDevice device, RTCMemoryMonitorFunc2 func, void* uniform userPtr);
- /*! \brief Implementation specific.
- This function is implementation specific and only for debugging
- purposes.
- WARNING: This function is deprecated do not use it.
- */
- RTCORE_DEPRECATED void rtcDebug(); // FIXME: remove
- #include "rtcore_scene.isph"
- #include "rtcore_geometry.isph"
- #include "rtcore_geometry_user.isph"
- /*! \} */
- #endif
|