66 template<
typename Format>
67 struct IsDeviceArrayFormat : std::bool_constant<
68 std::is_same_v<Format, PointXYZ> || std::is_same_v<Format, PointXYZW>
69 || std::is_same_v<Format, PointZ> || std::is_same_v<Format, SNR>
70 || std::is_same_v<Format, NormalXYZ> || std::is_same_v<Format, ColorRGBA>
71 || std::is_same_v<Format, ColorRGBA_SRGB> || std::is_same_v<Format, ColorBGRA>
72 || std::is_same_v<Format, ColorBGRA_SRGB> || std::is_same_v<Format, ColorRGBAf>
73 || std::is_same_v<Format, ColorRGB> || std::is_same_v<Format, ColorRGB_SRGB>
74 || std::is_same_v<Format, ColorBGR> || std::is_same_v<Format, ColorBGR_SRGB>>
108 template<
typename Format>
112 Detail::IsDeviceArrayFormat<Format>::value,
113 "Format must be one of: PointXYZ, PointXYZW, PointZ, SNR, NormalXYZ, "
114 "ColorRGBA, ColorRGBA_SRGB, ColorBGRA, ColorBGRA_SRGB, ColorRGBAf, ColorRGB, ColorRGB_SRGB, "
115 "ColorBGR, or ColorBGR_SRGB");
225 explicit DeviceArray(std::shared_ptr<class DeviceArrayInterface> impl);
226 const std::shared_ptr<class DeviceArrayInterface> &getImpl()
const;
230 std::shared_ptr<class DeviceArrayInterface> m_impl;
277 template<
typename Format>
281 Detail::IsDeviceArrayFormat<Format>::value,
282 "Format must be one of: PointXYZ, PointXYZW, PointZ, SNR, NormalXYZ, "
283 "ColorRGBA, ColorRGBA_SRGB, ColorBGRA, ColorBGRA_SRGB, ColorRGBAf, ColorRGB, ColorRGB_SRGB, "
284 "ColorBGR, or ColorBGR_SRGB");
365 explicit DeviceArrayView(std::shared_ptr<class DeviceArrayInterface> impl);
366 const std::shared_ptr<class DeviceArrayInterface> &getImpl()
const;
370 std::shared_ptr<class DeviceArrayInterface> m_impl;
394 template<
typename ColorFormat>
395 struct SupportedImageDeviceArrayColorFormat : std::false_type
399 struct SupportedImageDeviceArrayColorFormat<ColorRGBA> : std::true_type
403 struct SupportedImageDeviceArrayColorFormat<ColorBGRA> : std::true_type
407 struct SupportedImageDeviceArrayColorFormat<ColorRGBA_SRGB> : std::true_type
411 struct SupportedImageDeviceArrayColorFormat<ColorBGRA_SRGB> : std::true_type
415 struct SupportedImageDeviceArrayColorFormat<ColorRGBAf> : std::true_type
419 struct SupportedImageDeviceArrayColorFormat<ColorRGB> : std::true_type
423 struct SupportedImageDeviceArrayColorFormat<ColorRGB_SRGB> : std::true_type
427 struct SupportedImageDeviceArrayColorFormat<ColorBGR> : std::true_type
431 struct SupportedImageDeviceArrayColorFormat<ColorBGR_SRGB> : std::true_type
434 template<
typename Format>
435 struct SupportedDeviceArrayViewFormat : std::bool_constant<SupportedImageDeviceArrayColorFormat<Format>::value>
452 template<typename ColorFormat, typename = std::enable_if_t<Detail::SupportedImageColorFormat<ColorFormat>::value>>
470 template<typename ColorFormat, typename = std::enable_if_t<Detail::SupportedImageColorFormat<ColorFormat>::value>>
#define ZIVID_CORE_EXPORT_NON_WIN32
Definition CoreExport.h:61
One-dimensional container of data.
Definition Array1D.h:72
Two-dimensional container of data.
Definition Array2D.h:83
Non-owning view of a device buffer.
Definition DeviceArray.h:279
void * devicePointer() const
Get the raw GPU device pointer to the data.
DeviceArrayView(const DeviceArray< Format > &source)
Borrow a view from an owning DeviceArray.
DeviceArrayView(DeviceArrayView &&other) noexcept=default
Move constructor.
std::vector< int > stridesInBytes() const
Get the strides of the data in bytes.
size_t size() const
Get the total number of elements in the data.
Array2D< Format > toArray2D(StreamOrQueue streamOrQueue) const
Enqueue a device-to-host copy and return as Array2D without synchronizing.
bool isValid() const
Check if the buffer is valid (not empty)
size_t sizeInBytes() const
Get the total size of the data in bytes.
ComputeBackend backend() const
Get the GPU compute backend type of this buffer.
bool isEmpty() const
Check if the buffer is empty.
~DeviceArrayView()=default
Destructor.
DeviceArrayView()=default
Default constructor - creates an empty view.
DeviceArrayView(const DeviceArrayView &other)=default
Copy constructor - shares the view.
std::vector< int > strides() const
Get the strides of the data in element count.
DeviceArrayView & operator=(DeviceArrayView &&other) noexcept=default
Move assignment.
DeviceArrayView & operator=(const DeviceArrayView &other)=default
Copy assignment.
Array1D< Format > toArray1D(StreamOrQueue streamOrQueue) const
Enqueue a device-to-host copy and return as Array1D without synchronizing.
std::vector< int > shape() const
Get the shape of the data.
void copyToHost(Format *destination, size_t sizeInBytes, StreamOrQueue streamOrQueue) const
Enqueue a device-to-host copy without synchronizing.
Reference-counted handle to data on a GPU device.
Definition DeviceArray.h:110
ComputeBackend backend() const
Get the GPU compute backend type of this buffer.
void * devicePointer() const
Get the raw GPU device pointer to the data.
DeviceArray & operator=(const DeviceArray &other)=default
Copy assignment - shares ownership of the buffer.
DeviceArray(DeviceArray &&other) noexcept=default
Move constructor.
bool isEmpty() const
Check if the buffer is empty.
DeviceArray & operator=(DeviceArray &&other) noexcept=default
Move assignment.
size_t size() const
Get the total number of elements in the data.
std::vector< int > strides() const
Get the strides of the data in element count.
void copyToHost(Format *destination, size_t sizeInBytes, StreamOrQueue streamOrQueue) const
Copy device buffer data to host memory.
Array2D< Format > toArray2D(StreamOrQueue streamOrQueue) const
Copy device buffer data to host and return as Array2D.
size_t sizeInBytes() const
Get the total size of the data in bytes.
DeviceArray(const DeviceArray &other)=default
Copy constructor - shares ownership of the buffer.
~DeviceArray()=default
Destructor - releases reference to the underlying buffer.
bool isValid() const
Check if the buffer is valid (not empty)
Array1D< Format > toArray1D(StreamOrQueue streamOrQueue) const
Copy device buffer data to host and return as Array1D.
std::vector< int > shape() const
Get the shape of the data.
std::vector< int > stridesInBytes() const
Get the strides of the data in bytes.
DeviceArray()=default
Default constructor - creates an empty DeviceArray.
A 2-dimensional image.
Definition Image.h:141
Definition EnvironmentInfo.h:74
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:85
Image< ColorFormat > toImage(const DeviceArray< ColorFormat > &buffer, StreamOrQueue streamOrQueue)
Enqueue a device-to-host copy and return as Image without synchronizing.
Definition DeviceArray.h:453
ComputeBackend
GPU compute backend type.
Definition ComputeWrappers.h:52
A user CUDA stream or OpenCL command queue, selected by which member is populated.
Definition ComputeWrappers.h:106