Path Tracing
Loading...
Searching...
No Matches
oidn.hpp File Reference
#include "oidn.h"
#include <cstdint>
#include <cassert>
#include <cstring>
#include <algorithm>
#include <type_traits>
#include <vector>
#include <array>
#include <string>
Include dependency graph for oidn.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  IsFlag< FlagT >
class  Flags< FlagT >
struct  IsFlag< ExternalMemoryTypeFlag >
class  BufferRef
struct  IsFlag< ExternalSemaphoreTypeFlag >
class  SemaphoreRef
class  FilterRef
struct  UUID
struct  LUID
class  DeviceRef
class  PhysicalDeviceRef

Typedefs

using ExternalMemoryTypeFlags = Flags<ExternalMemoryTypeFlag>
using ExternalSemaphoreTypeFlags = Flags<ExternalSemaphoreTypeFlag>
using ProgressMonitorFunction = OIDNProgressMonitorFunction
typedef void(* ErrorFunction) (void *userPtr, Error code, const char *message)

Enumerations

enum class  Format {
  Undefined = OIDN_FORMAT_UNDEFINED , Float = OIDN_FORMAT_FLOAT , Float2 = OIDN_FORMAT_FLOAT2 , Float3 = OIDN_FORMAT_FLOAT3 ,
  Float4 = OIDN_FORMAT_FLOAT4 , Half = OIDN_FORMAT_HALF , Half2 = OIDN_FORMAT_HALF2 , Half3 = OIDN_FORMAT_HALF3 ,
  Half4 = OIDN_FORMAT_HALF4
}
enum class  Storage { Undefined = OIDN_STORAGE_UNDEFINED , Host = OIDN_STORAGE_HOST , Device = OIDN_STORAGE_DEVICE , Managed = OIDN_STORAGE_MANAGED }
enum class  ExternalMemoryTypeFlag {
  None = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_NONE , OpaqueFD = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_FD , DMABuf = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_DMA_BUF , OpaqueWin32 = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_WIN32 ,
  OpaqueWin32KMT = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_OPAQUE_WIN32_KMT , D3D11Texture = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_D3D11_TEXTURE , D3D11TextureKMT = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_D3D11_TEXTURE_KMT , D3D11Resource = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_D3D11_RESOURCE ,
  D3D11ResourceKMT = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_D3D11_RESOURCE_KMT , D3D12Heap = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_D3D12_HEAP , D3D12Resource = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_D3D12_RESOURCE , Dedicated = OIDN_EXTERNAL_MEMORY_TYPE_FLAG_DEDICATED
}
enum class  ExternalSemaphoreTypeFlag {
  None = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_NONE , OpaqueFD = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_OPAQUE_FD , OpaqueWin32 = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_OPAQUE_WIN32 , OpaqueWin32KMT = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_OPAQUE_WIN32_KMT ,
  D3D11Fence = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_D3D11_FENCE , D3D12Fence = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_D3D12_FENCE , KeyedMutex = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_KEYED_MUTEX , KeyedMutexKMT = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_KEYED_MUTEX_KMT ,
  TimelineSemaphoreFD = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_TIMELINE_SEMAPHORE_FD , TimelineSemaphoreWin32 = OIDN_EXTERNAL_SEMAPHORE_TYPE_FLAG_TIMELINE_SEMAPHORE_WIN32
}
enum class  Quality { Default = OIDN_QUALITY_DEFAULT , Fast = OIDN_QUALITY_FAST , Balanced = OIDN_QUALITY_BALANCED , High = OIDN_QUALITY_HIGH }
enum class  DeviceType {
  Default = OIDN_DEVICE_TYPE_DEFAULT , CPU = OIDN_DEVICE_TYPE_CPU , SYCL = OIDN_DEVICE_TYPE_SYCL , CUDA = OIDN_DEVICE_TYPE_CUDA ,
  HIP = OIDN_DEVICE_TYPE_HIP , Metal = OIDN_DEVICE_TYPE_METAL
}
enum class  Error {
  None = OIDN_ERROR_NONE , Unknown = OIDN_ERROR_UNKNOWN , InvalidArgument = OIDN_ERROR_INVALID_ARGUMENT , InvalidOperation = OIDN_ERROR_INVALID_OPERATION ,
  OutOfMemory = OIDN_ERROR_OUT_OF_MEMORY , UnsupportedHardware = OIDN_ERROR_UNSUPPORTED_HARDWARE , Cancelled = OIDN_ERROR_CANCELLED
}

Functions

template<typename FlagT>
constexpr Flags< FlagT > operator& (FlagT a, const Flags< FlagT > &b) noexcept
template<typename FlagT>
constexpr Flags< FlagT > operator| (FlagT a, const Flags< FlagT > &b) noexcept
template<typename FlagT>
constexpr Flags< FlagT > operator^ (FlagT a, const Flags< FlagT > &b) noexcept
template<typename FlagT, typename std::enable_if< IsFlag< FlagT >::value, bool >::type = true>
constexpr Flags< FlagT > operator& (FlagT a, FlagT b) noexcept
template<typename FlagT, typename std::enable_if< IsFlag< FlagT >::value, bool >::type = true>
constexpr Flags< FlagT > operator| (FlagT a, FlagT b) noexcept
template<typename FlagT, typename std::enable_if< IsFlag< FlagT >::value, bool >::type = true>
constexpr Flags< FlagT > operator^ (FlagT a, FlagT b) noexcept
Error getError ()
Error getError (const char *&outMessage)
bool isCPUDeviceSupported ()
bool isCUDADeviceSupported (int deviceID)
bool isHIPDeviceSupported (int deviceID)
bool isMetalDeviceSupported (MTLDevice_id device)
DeviceRef newDevice (DeviceType type=DeviceType::Default)
DeviceRef newDevice (int physicalDeviceID)
DeviceRef newDevice (const UUID &uuid)
DeviceRef newDevice (const LUID &luid)
DeviceRef newDevice (int pciDomain, int pciBus, int pciDevice, int pciFunction)
DeviceRef newCUDADevice (int deviceID, cudaStream_t stream)
DeviceRef newCUDADevice (const std::vector< int > &deviceIDs, const std::vector< cudaStream_t > &streams)
DeviceRef newHIPDevice (int deviceID, hipStream_t stream)
DeviceRef newHIPDevice (const std::vector< int > &deviceIDs, const std::vector< hipStream_t > &streams)
DeviceRef newMetalDevice (MTLCommandQueue_id commandQueue)
DeviceRef newMetalDevice (const std::vector< MTLCommandQueue_id > &commandQueues)
int getNumPhysicalDevices ()

Typedef Documentation

◆ ErrorFunction

typedef void(* ErrorFunction) (void *userPtr, Error code, const char *message)

◆ ExternalMemoryTypeFlags

◆ ExternalSemaphoreTypeFlags

◆ ProgressMonitorFunction

Enumeration Type Documentation

◆ DeviceType

enum class DeviceType
strong
Enumerator
Default 
CPU 
SYCL 
CUDA 
HIP 
Metal 

◆ Error

enum class Error
strong
Enumerator
None 
Unknown 
InvalidArgument 
InvalidOperation 
OutOfMemory 
UnsupportedHardware 
Cancelled 

◆ ExternalMemoryTypeFlag

enum class ExternalMemoryTypeFlag
strong
Enumerator
None 
OpaqueFD 
DMABuf 
OpaqueWin32 
OpaqueWin32KMT 
D3D11Texture 
D3D11TextureKMT 
D3D11Resource 
D3D11ResourceKMT 
D3D12Heap 
D3D12Resource 
Dedicated 

◆ ExternalSemaphoreTypeFlag

enum class ExternalSemaphoreTypeFlag
strong
Enumerator
None 
OpaqueFD 
OpaqueWin32 
OpaqueWin32KMT 
D3D11Fence 
D3D12Fence 
KeyedMutex 
KeyedMutexKMT 
TimelineSemaphoreFD 
TimelineSemaphoreWin32 

◆ Format

enum class Format
strong
Enumerator
Undefined 
Float 
Float2 
Float3 
Float4 
Half 
Half2 
Half3 
Half4 

◆ Quality

enum class Quality
strong
Enumerator
Default 
Fast 
Balanced 
High 

◆ Storage

enum class Storage
strong
Enumerator
Undefined 
Host 
Device 
Managed 

Function Documentation

◆ getError() [1/2]

Error getError ( )
inline

◆ getError() [2/2]

Error getError ( const char *& outMessage)
inline

◆ getNumPhysicalDevices()

int getNumPhysicalDevices ( )
inline

◆ isCPUDeviceSupported()

bool isCPUDeviceSupported ( )
inline

◆ isCUDADeviceSupported()

bool isCUDADeviceSupported ( int deviceID)
inline

◆ isHIPDeviceSupported()

bool isHIPDeviceSupported ( int deviceID)
inline

◆ isMetalDeviceSupported()

bool isMetalDeviceSupported ( MTLDevice_id device)
inline

◆ newCUDADevice() [1/2]

DeviceRef newCUDADevice ( const std::vector< int > & deviceIDs,
const std::vector< cudaStream_t > & streams )
inline

◆ newCUDADevice() [2/2]

DeviceRef newCUDADevice ( int deviceID,
cudaStream_t stream )
inline

◆ newDevice() [1/5]

DeviceRef newDevice ( const LUID & luid)
inline

◆ newDevice() [2/5]

DeviceRef newDevice ( const UUID & uuid)
inline

◆ newDevice() [3/5]

DeviceRef newDevice ( DeviceType type = DeviceType::Default)
inline

◆ newDevice() [4/5]

DeviceRef newDevice ( int pciDomain,
int pciBus,
int pciDevice,
int pciFunction )
inline

◆ newDevice() [5/5]

DeviceRef newDevice ( int physicalDeviceID)
inline

◆ newHIPDevice() [1/2]

DeviceRef newHIPDevice ( const std::vector< int > & deviceIDs,
const std::vector< hipStream_t > & streams )
inline

◆ newHIPDevice() [2/2]

DeviceRef newHIPDevice ( int deviceID,
hipStream_t stream )
inline

◆ newMetalDevice() [1/2]

DeviceRef newMetalDevice ( const std::vector< MTLCommandQueue_id > & commandQueues)
inline

◆ newMetalDevice() [2/2]

DeviceRef newMetalDevice ( MTLCommandQueue_id commandQueue)
inline

◆ operator&() [1/2]

template<typename FlagT>
Flags< FlagT > operator& ( FlagT a,
const Flags< FlagT > & b )
inlineconstexprnoexcept

◆ operator&() [2/2]

template<typename FlagT, typename std::enable_if< IsFlag< FlagT >::value, bool >::type = true>
Flags< FlagT > operator& ( FlagT a,
FlagT b )
inlineconstexprnoexcept

◆ operator^() [1/2]

template<typename FlagT>
Flags< FlagT > operator^ ( FlagT a,
const Flags< FlagT > & b )
inlineconstexprnoexcept

◆ operator^() [2/2]

template<typename FlagT, typename std::enable_if< IsFlag< FlagT >::value, bool >::type = true>
Flags< FlagT > operator^ ( FlagT a,
FlagT b )
inlineconstexprnoexcept

◆ operator|() [1/2]

template<typename FlagT>
Flags< FlagT > operator| ( FlagT a,
const Flags< FlagT > & b )
inlineconstexprnoexcept

◆ operator|() [2/2]

template<typename FlagT, typename std::enable_if< IsFlag< FlagT >::value, bool >::type = true>
Flags< FlagT > operator| ( FlagT a,
FlagT b )
inlineconstexprnoexcept