11 #include <type_traits>
22 template<
typename FlagT>
25 static constexpr
bool value =
false;
28 template<
typename FlagT>
37 constexpr
Flags(FlagT flag) noexcept :
mask(static_cast<MaskType>(flag)) {}
70 constexpr
explicit operator bool() const noexcept {
return mask; }
71 constexpr
explicit operator MaskType() const noexcept {
return mask; }
77 template<
typename FlagT>
83 template<
typename FlagT>
89 template<
typename FlagT>
211 other.handle =
nullptr;
254 operator bool()
const
290 void read(
size_t byteOffset,
size_t byteSize,
void* dstHostPtr)
const
296 void readAsync(
size_t byteOffset,
size_t byteSize,
void* dstHostPtr)
const
302 void write(
size_t byteOffset,
size_t byteSize,
const void* srcHostPtr)
308 void writeAsync(
size_t byteOffset,
size_t byteSize,
const void* srcHostPtr)
348 other.handle =
nullptr;
391 operator bool()
const
410 size_t byteOffset = 0,
411 size_t pixelByteStride = 0,
size_t rowByteStride = 0)
417 pixelByteStride, rowByteStride);
424 size_t byteOffset = 0,
425 size_t pixelByteStride = 0,
size_t rowByteStride = 0)
428 devPtr, static_cast<OIDNFormat>(format),
431 pixelByteStride, rowByteStride);
495 T get(
const char*
name)
const;
521 #if defined(SYCL_LANGUAGE_VERSION)
527 oidnExecuteSYCLFilterAsync(
handle, depEvents.data(),
static_cast<int>(depEvents.size()), &doneEvent);
626 other.handle =
nullptr;
669 operator bool()
const
704 T get(
const char*
name)
const;
763 handle, static_cast<OIDNExternalMemoryTypeFlag>(fdType), fd, byteSize);
770 this->handle, static_cast<OIDNExternalMemoryTypeFlag>(handleType), handle, name, byteSize);
775 #if defined(__OBJC__)
865 #if defined(SYCL_LANGUAGE_VERSION)
869 return DeviceRef(oidnNewSYCLDevice(&queue, 1));
875 inline DeviceRef newSYCLDevice(
const std::vector<sycl::queue>& queues)
877 return DeviceRef(oidnNewSYCLDevice(queues.data(),
static_cast<int>(queues.size())));
892 const std::vector<cudaStream_t>& streams)
894 assert(deviceIDs.size() == streams.size());
896 static_cast<int>(streams.size())));
910 const std::vector<hipStream_t>& streams)
912 assert(deviceIDs.size() == streams.size());
914 static_cast<int>(streams.size())));
951 operator bool()
const
958 T get(
const char*
name)
const;
965 return {
ptr, byteSize};
1018 return str ? str :
"";
1026 if (
data.first !=
nullptr)
1028 if (
data.second ==
sizeof(uuid.bytes))
1029 std::memcpy(uuid.bytes,
data.first,
sizeof(uuid.bytes));
1041 if (
data.first !=
nullptr)
1043 if (
data.second ==
sizeof(luid.bytes))
1044 std::memcpy(luid.bytes,
data.first,
sizeof(luid.bytes));
void set(const char *name, int value)
OIDNDevice getHandle() const
GLuint GLsizei const GLchar * message
constexpr Flags(MaskType mask) noexcept
BufferRef newBuffer(ExternalMemoryTypeFlag fdType, int fd, size_t byteSize) const
constexpr bool operator==(const Flags &b) const noexcept
void unsetData(const char *name)
OIDN_API void oidnSetDeviceInt(OIDNDevice device, const char *name, int value)
OIDN_API OIDNDevice oidnNewCUDADevice(const int *deviceIDs, const cudaStream_t *streams, int numPairs)
OIDNFilter getHandle() const
OIDN_API void oidnExecuteFilterAsync(OIDNFilter filter)
BufferRef newBuffer(size_t byteSize) const
OIDN_API OIDNBuffer oidnNewSharedBufferFromWin32Handle(OIDNDevice device, OIDNExternalMemoryTypeFlag handleType, void *handle, const void *name, size_t byteSize)
OIDN_API void oidnExecuteFilter(OIDNFilter filter)
Flags & operator|=(const Flags &b) noexcept
OIDN_API void oidnReadBufferAsync(OIDNBuffer buffer, size_t byteOffset, size_t byteSize, void *dstHostPtr)
Flags & operator^=(const Flags &b) noexcept
constexpr Flags< FlagT > operator^(FlagT a, const Flags< FlagT > &b) noexcept
OIDN_API void oidnReleaseDevice(OIDNDevice device)
OIDN_API void oidnSetFilterImage(OIDNFilter filter, const char *name, OIDNBuffer buffer, OIDNFormat format, size_t width, size_t height, size_t byteOffset, size_t pixelByteStride, size_t rowByteStride)
OIDN_API void oidnReleaseFilter(OIDNFilter filter)
uint8_t bytes[OIDN_LUID_SIZE]
void setImage(const char *name, const BufferRef &buffer, Format format, size_t width, size_t height, size_t byteOffset=0, size_t pixelByteStride=0, size_t rowByteStride=0)
getFileOption("OpenEXR:storage") storage
void swap(UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &a, UT::ArraySet< Key, MULTI, MAX_LOAD_FACTOR_256, Clearer, Hash, KeyEqual > &b)
PhysicalDeviceRef & operator=(int other)
OIDN_API void oidnUnsetFilterImage(OIDNFilter filter, const char *name)
GLsizei const GLchar *const * string
GLsizei const GLfloat * value
void readAsync(size_t byteOffset, size_t byteSize, void *dstHostPtr) const
OIDN_API bool oidnGetDeviceBool(OIDNDevice device, const char *name)
GLuint64 GLenum handleType
OIDN_API void oidnSetSharedFilterImage(OIDNFilter filter, const char *name, void *devPtr, OIDNFormat format, size_t width, size_t height, size_t byteOffset, size_t pixelByteStride, size_t rowByteStride)
OIDN_API void oidnSetFilterInt(OIDNFilter filter, const char *name, int value)
OIDN_API void oidnUnsetFilterData(OIDNFilter filter, const char *name)
Flags & operator=(const Flags &b) noexcept=default
OIDN_API OIDNDevice oidnNewHIPDevice(const int *deviceIDs, const hipStream_t *streams, int numPairs)
OIDN_API int oidnGetFilterInt(OIDNFilter filter, const char *name)
T get(const char *name) const
OIDNProgressMonitorFunction ProgressMonitorFunction
void setErrorFunction(ErrorFunction func, void *userPtr=nullptr)
GLboolean GLboolean GLboolean GLboolean a
constexpr Flags() noexcept
void writeAsync(size_t byteOffset, size_t byteSize, const void *srcHostPtr)
OIDN_API int oidnGetNumPhysicalDevices()
OIDN_API int oidnGetPhysicalDeviceInt(int physicalDeviceID, const char *name)
constexpr Flags(FlagT flag) noexcept
Storage getStorage() const
OIDN_API float oidnGetFilterFloat(OIDNFilter filter, const char *name)
struct ihipStream_t * hipStream_t
DeviceRef(const DeviceRef &other)
struct OIDNFilterImpl * OIDNFilter
void setProgressMonitorFunction(ProgressMonitorFunction func, void *userPtr=nullptr)
void write(size_t byteOffset, size_t byteSize, const void *srcHostPtr)
constexpr Flags operator|(const Flags &b) const noexcept
OIDN_API void oidnWriteBufferAsync(OIDNBuffer buffer, size_t byteOffset, size_t byteSize, const void *srcHostPtr)
Flags< ExternalMemoryTypeFlag > ExternalMemoryTypeFlags
FilterRef(OIDNFilter handle)
OIDN_API void oidnRetainFilter(OIDNFilter filter)
BufferRef(OIDNBuffer handle)
OIDN_API void oidnRetainBuffer(OIDNBuffer buffer)
DeviceRef(OIDNDevice handle)
GLint GLsizei GLsizei height
struct OIDNBufferImpl * OIDNBuffer
constexpr Flags operator^(const Flags &b) const noexcept
void setImage(const char *name, void *devPtr, Format format, size_t width, size_t height, size_t byteOffset=0, size_t pixelByteStride=0, size_t rowByteStride=0)
DeviceRef(DeviceRef &&other) noexcept
BufferRef(BufferRef &&other) noexcept
void updateData(const char *name)
DeviceRef newHIPDevice(int deviceID, hipStream_t stream)
BufferRef & operator=(const BufferRef &other)
void setData(const char *name, void *hostPtr, size_t byteSize)
OIDN_API void oidnUpdateFilterData(OIDNFilter filter, const char *name)
DeviceRef newMetalDevice(MTLCommandQueue_id commandQueue)
constexpr Flags< FlagT > operator|(FlagT a, const Flags< FlagT > &b) noexcept
BufferRef newBuffer(void *ptr, size_t byteSize) const
OIDN_API void oidnWriteBuffer(OIDNBuffer buffer, size_t byteOffset, size_t byteSize, const void *srcHostPtr)
FilterRef & operator=(const FilterRef &other)
OIDN_API void oidnReleaseBuffer(OIDNBuffer buffer)
OIDNBuffer getHandle() const
void * MTLCommandQueue_id
OIDN_API void oidnRetainDevice(OIDNDevice device)
OIDN_API const char * oidnGetPhysicalDeviceString(int physicalDeviceID, const char *name)
void set(const char *name, float value)
void removeData(const char *name)
OIDN_API void oidnCommitFilter(OIDNFilter filter)
OIDN_API void oidnSetFilterProgressMonitorFunction(OIDNFilter filter, OIDNProgressMonitorFunction func, void *userPtr)
OIDN_API void oidnSetFilterBool(OIDNFilter filter, const char *name, bool value)
GLint GLint GLsizei GLint GLenum format
constexpr Flags< FlagT > operator&(FlagT a, const Flags< FlagT > &b) noexcept
FilterRef(FilterRef &&other) noexcept
OIDN_API OIDNBuffer oidnNewSharedBufferFromFD(OIDNDevice device, OIDNExternalMemoryTypeFlag fdType, int fd, size_t byteSize)
OIDN_API bool oidnGetPhysicalDeviceBool(int physicalDeviceID, const char *name)
OIDN_API void oidnCommitDevice(OIDNDevice device)
OIDN_API void * oidnGetBufferData(OIDNBuffer buffer)
#define OIDN_DEPRECATED(msg)
void set(const char *name, bool value)
OIDN_API OIDNBuffer oidnNewSharedBufferFromMetal(OIDNDevice device, MTLBuffer_id buffer)
Flags & operator&=(const Flags &b) noexcept
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the queue
OIDN_API void oidnSyncDevice(OIDNDevice device)
OIDN_API OIDNBuffer oidnNewBuffer(OIDNDevice device, size_t byteSize)
OIDN_API OIDNDevice oidnNewDevice(OIDNDeviceType type)
FilterRef(const FilterRef &other)
OIDN_API void oidnSetDeviceErrorFunction(OIDNDevice device, OIDNErrorFunction func, void *userPtr)
T get(const char *name) const
#define OIDN_NAMESPACE_BEGIN
void read(size_t byteOffset, size_t byteSize, void *dstHostPtr) const
OIDN_API OIDNStorage oidnGetBufferStorage(OIDNBuffer buffer)
GLuint const GLchar * name
std::pair< const void *, size_t > getData(const char *name) const
GLboolean GLboolean GLboolean b
OIDN_API OIDNBuffer oidnNewSharedBuffer(OIDNDevice device, void *devPtr, size_t byteSize)
struct CUstream_st * cudaStream_t
OIDN_API OIDNDevice oidnNewMetalDevice(const MTLCommandQueue_id *commandQueues, int numQueues)
OIDN_API size_t oidnGetBufferSize(OIDNBuffer buffer)
PhysicalDeviceRef(int id)
constexpr Flags operator&(const Flags &b) const noexcept
void unsetImage(const char *name)
BufferRef newBuffer(ExternalMemoryTypeFlag handleType, void *handle, const void *name, size_t byteSize) const
Error getError(const char *&outMessage)
OIDN_API void oidnSetFilterFloat(OIDNFilter filter, const char *name, float value)
OIDN_API void oidnSetSharedFilterData(OIDNFilter filter, const char *name, void *hostPtr, size_t byteSize)
OIDN_API OIDNDevice oidnNewDeviceByLUID(const void *luid)
DeviceRef newDevice(DeviceType type=DeviceType::Default)
void set(const char *name, int value)
FilterRef newFilter(const char *type) const
unsigned int oidnGetDeviceUInt(OIDNDevice device, const char *name)
bool(* OIDNProgressMonitorFunction)(void *userPtr, double n)
void removeImage(const char *name)
DeviceRef newCUDADevice(int deviceID, cudaStream_t stream)
struct OIDNDeviceImpl * OIDNDevice
OIDN_API const void * oidnGetPhysicalDeviceData(int physicalDeviceID, const char *name, size_t *byteSize)
OIDN_API bool oidnGetFilterBool(OIDNFilter filter, const char *name)
unsigned int oidnGetPhysicalDeviceUInt(int physicalDeviceID, const char *name)
OIDN_API void oidnReadBuffer(OIDNBuffer buffer, size_t byteOffset, size_t byteSize, void *dstHostPtr)
constexpr bool operator!() const noexcept
void set(const char *name, bool value)
void(* ErrorFunction)(void *userPtr, Error code, const char *message)
int getNumPhysicalDevices()
OIDN_API OIDNDevice oidnNewDeviceByPCIAddress(int pciDomain, int pciBus, int pciDevice, int pciFunction)
BufferRef newBuffer(size_t byteSize, Storage storage) const
OIDN_API OIDNBuffer oidnNewBufferWithStorage(OIDNDevice device, size_t byteSize, OIDNStorage storage)
void set(const char *name, unsigned int value)
BufferRef(const BufferRef &other)
OIDN_API OIDNDevice oidnNewDeviceByID(int physicalDeviceID)
OIDN_API OIDNDevice oidnNewDeviceByUUID(const void *uuid)
OIDN_API OIDNFilter oidnNewFilter(OIDNDevice device, const char *type)
OIDN_API void oidnSetDeviceBool(OIDNDevice device, const char *name, bool value)
void oidnSetDeviceUInt(OIDNDevice device, const char *name, unsigned int value)
void set(const char *name, Quality value)
T get(const char *name) const
uint8_t bytes[OIDN_UUID_SIZE]
OIDN_API OIDNError oidnGetDeviceError(OIDNDevice device, const char **outMessage)
typename std::underlying_type< FlagT >::type MaskType
#define OIDN_NAMESPACE_END
constexpr bool operator!=(const Flags &b) const noexcept
DeviceRef & operator=(const DeviceRef &other)
OIDN_API int oidnGetDeviceInt(OIDNDevice device, const char *name)