go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Public Types | Public Member Functions
itk::OpenCLBuffer Class Reference

#include <itkOpenCLBuffer.h>

Detailed Description

The OpenCLBuffer class represents an OpenCL buffer object.

See also
OpenCLMemoryObject, OpenCLVector

Definition at line 53 of file itkOpenCLBuffer.h.

+ Inheritance diagram for itk::OpenCLBuffer:

Public Types

typedef OpenCLBuffer Self
 
- Public Types inherited from itk::OpenCLMemoryObject
enum  Access { ReadWrite = 0x0001 , WriteOnly = 0x0002 , ReadOnly = 0x0004 }
 
typedef Point< std::vcl_size_t, 2 > PointType
 
typedef Size< 4 > RectangleType
 
typedef OpenCLMemoryObject Self
 
typedef Size< 2 > SizeType
 

Public Member Functions

bool CopyToBuffer (const OpenCLBuffer &dest, const std::vcl_size_t size, const std::vcl_size_t dst_offset=0, const std::vcl_size_t offset=0)
 
OpenCLEvent CopyToBufferAsync (const OpenCLBuffer &dest, const std::vcl_size_t size, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t dst_offset=0, const std::vcl_size_t offset=0)
 
bool CopyToImage (const OpenCLImage &dest, const OpenCLSize &origin, const OpenCLSize &region, const std::vcl_size_t src_offset=0)
 
OpenCLEvent CopyToImageAsync (const OpenCLImage &dest, const OpenCLSize &origin, const OpenCLSize &region, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t src_offset=0)
 
bool CopyToRect (const OpenCLBuffer &dest, const RectangleType &rect, const PointType &destPoint, const std::vcl_size_t bufferBytesPerLine, std::vcl_size_t destBytesPerLine)
 
bool CopyToRect (const OpenCLBuffer &dest, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t destOrigin[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t destBytesPerLine, const std::vcl_size_t destBytesPerSlice)
 
OpenCLEvent CopyToRectAsync (const OpenCLBuffer &dest, const RectangleType &rect, const PointType &destPoint, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t destBytesPerLine, const OpenCLEventList &event_list=OpenCLEventList())
 
OpenCLEvent CopyToRectAsync (const OpenCLBuffer &dest, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t destOrigin[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t destBytesPerLine, const std::vcl_size_t destBytesPerSlice, const OpenCLEventList &event_list=OpenCLEventList())
 
OpenCLBuffer CreateSubBuffer (const OpenCLMemoryObject::Access access, const std::vcl_size_t size, const std::vcl_size_t offset=0)
 
std::vcl_size_t GetOffset () const
 
OpenCLBuffer GetParentBuffer () const
 
void * Map (const OpenCLMemoryObject::Access access)
 
void * Map (const OpenCLMemoryObject::Access access, const std::vcl_size_t size, const std::vcl_size_t offset=0)
 
OpenCLEvent MapAsync (void **ptr, const OpenCLMemoryObject::Access access, const std::vcl_size_t size, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t offset=0)
 
 OpenCLBuffer ()
 
 OpenCLBuffer (const OpenCLBuffer &other)
 
 OpenCLBuffer (OpenCLContext *context, const cl_mem id)
 
OpenCLBufferoperator= (const OpenCLBuffer &other)
 
bool Read (void *data, const std::vcl_size_t size, const std::vcl_size_t offset=0)
 
OpenCLEvent ReadAsync (void *data, const std::vcl_size_t size, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t offset=0)
 
bool ReadRect (void *data, const RectangleType &rect, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t hostBytesPerLine)
 
bool ReadRect (void *data, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t hostBytesPerLine, const std::vcl_size_t hostBytesPerSlice)
 
OpenCLEvent ReadRectAsync (void *data, const RectangleType &rect, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t hostBytesPerLine, const OpenCLEventList &event_list=OpenCLEventList())
 
OpenCLEvent ReadRectAsync (void *data, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t hostBytesPerLine, const std::vcl_size_t hostBytesPerSlice, const OpenCLEventList &event_list=OpenCLEventList())
 
bool Write (const void *data, const std::vcl_size_t size, const std::vcl_size_t offset=0)
 
OpenCLEvent WriteAsync (const void *data, const std::vcl_size_t size, const OpenCLEventList &event_list=OpenCLEventList(), const std::vcl_size_t offset=0)
 
bool WriteRect (const void *data, const RectangleType &rect, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t hostBytesPerLine)
 
bool WriteRect (const void *data, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t hostBytesPerLine, const std::vcl_size_t hostBytesPerSlice)
 
OpenCLEvent WriteRectAsync (const void *data, const RectangleType &rect, const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t hostBytesPerLine, const OpenCLEventList &event_list=OpenCLEventList())
 
OpenCLEvent WriteRectAsync (const void *data, const std::vcl_size_t origin[3], const std::vcl_size_t size[3], const std::vcl_size_t bufferBytesPerLine, const std::vcl_size_t bufferBytesPerSlice, const std::vcl_size_t hostBytesPerLine, const std::vcl_size_t hostBytesPerSlice, const OpenCLEventList &event_list=OpenCLEventList())
 
- Public Member Functions inherited from itk::OpenCLMemoryObject
OpenCLMemoryObject::Access GetAccess () const
 
OpenCLContextGetContext () const
 
cl_mem_flags GetFlags () const
 
void * GetHostPointer () const
 
cl_uint GetMapCount () const
 
cl_mem GetMemoryId () const
 
cl_mem_object_type GetMemoryType () const
 
cl_uint GetReferenceCount () const
 
std::vcl_size_t GetSize () const
 
bool IsNull () const
 
cl_int SetDestructorCallback (void(CL_CALLBACK *pfn_notify)(cl_mem, void *), void *user_data=nullptr)
 
void Unmap (void *ptr, const bool wait=false)
 
OpenCLEvent UnmapAsync (void *ptr, const OpenCLEventList &event_list=OpenCLEventList())
 

Additional Inherited Members

- Protected Member Functions inherited from itk::OpenCLMemoryObject
cl_map_flags GetMapFlags (const OpenCLMemoryObject::Access access)
 
 OpenCLMemoryObject (OpenCLContext *context, const cl_mem id)
 
 OpenCLMemoryObject (OpenCLContext *context=0)
 
void SetId (OpenCLContext *context, const cl_mem id)
 
 ~OpenCLMemoryObject ()
 

Member Typedef Documentation

◆ Self

Standard class typedefs.

Definition at line 58 of file itkOpenCLBuffer.h.

Constructor & Destructor Documentation

◆ OpenCLBuffer() [1/3]

itk::OpenCLBuffer::OpenCLBuffer ( )
inline

Constructs a null OpenCL buffer object.

Definition at line 61 of file itkOpenCLBuffer.h.

◆ OpenCLBuffer() [2/3]

itk::OpenCLBuffer::OpenCLBuffer ( OpenCLContext context,
const cl_mem  id 
)

Constructs an OpenCL buffer object that is initialized with the native OpenCL identifier id, and associates it with context. This class will take over ownership of id and will release it in the destructor.

◆ OpenCLBuffer() [3/3]

itk::OpenCLBuffer::OpenCLBuffer ( const OpenCLBuffer other)

Constructs a copy of other.

Member Function Documentation

◆ CopyToBuffer()

bool itk::OpenCLBuffer::CopyToBuffer ( const OpenCLBuffer dest,
const std::vcl_size_t  size,
const std::vcl_size_t  dst_offset = 0,
const std::vcl_size_t  offset = 0 
)

Copies the size bytes at offset in this buffer be copied to dst_offset in the buffer dest. Returns true if the copy was successful, false otherwise. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
CopyToAsync()

◆ CopyToBufferAsync()

OpenCLEvent itk::OpenCLBuffer::CopyToBufferAsync ( const OpenCLBuffer dest,
const std::vcl_size_t  size,
const OpenCLEventList event_list = OpenCLEventList(),
const std::vcl_size_t  dst_offset = 0,
const std::vcl_size_t  offset = 0 
)

Asynchronous version of the CopyToBuffer() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
CopyTo(), OpenCLEvent::IsComplete()

◆ CopyToImage()

bool itk::OpenCLBuffer::CopyToImage ( const OpenCLImage dest,
const OpenCLSize origin,
const OpenCLSize region,
const std::vcl_size_t  src_offset = 0 
)

Copies the contents of this buffer, starting at origin and range region in dest. Returns true if the copy was successful, false otherwise. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
CopyToAsync()

◆ CopyToImageAsync()

OpenCLEvent itk::OpenCLBuffer::CopyToImageAsync ( const OpenCLImage dest,
const OpenCLSize origin,
const OpenCLSize region,
const OpenCLEventList event_list = OpenCLEventList(),
const std::vcl_size_t  src_offset = 0 
)

Asynchronous version of the CopyToImage() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
CopyTo(), OpenCLEvent::IsComplete()

◆ CopyToRect() [1/2]

bool itk::OpenCLBuffer::CopyToRect ( const OpenCLBuffer dest,
const RectangleType rect,
const PointType destPoint,
const std::vcl_size_t  bufferBytesPerLine,
std::vcl_size_t  destBytesPerLine 
)

Copies the contents of rect within this buffer to dest, starting at destPoint. The source and destination line pitch values are given by bufferBytesPerLine and destBytesPerLine respectively. Returns true if the copy was successful, false otherwise. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
CopyToRectAsync()

◆ CopyToRect() [2/2]

bool itk::OpenCLBuffer::CopyToRect ( const OpenCLBuffer dest,
const std::vcl_size_t  origin[3],
const std::vcl_size_t  size[3],
const std::vcl_size_t  destOrigin[3],
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  bufferBytesPerSlice,
const std::vcl_size_t  destBytesPerLine,
const std::vcl_size_t  destBytesPerSlice 
)

Copies the 3D rectangle defined by origin and size within this buffer to destOrigin within dest. The source and destination pitch values are given by bufferBytesPerLine, bufferBytesPerSlice, destBytesPerLine, and destBytesPerSlice. Returns true if the copy was successful, false otherwise. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
CopyToRectAsync()

◆ CopyToRectAsync() [1/2]

OpenCLEvent itk::OpenCLBuffer::CopyToRectAsync ( const OpenCLBuffer dest,
const RectangleType rect,
const PointType destPoint,
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  destBytesPerLine,
const OpenCLEventList event_list = OpenCLEventList() 
)

Asynchronous version of the CopyToRect() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
CopyToRect(), OpenCLEvent::IsComplete()

◆ CopyToRectAsync() [2/2]

OpenCLEvent itk::OpenCLBuffer::CopyToRectAsync ( const OpenCLBuffer dest,
const std::vcl_size_t  origin[3],
const std::vcl_size_t  size[3],
const std::vcl_size_t  destOrigin[3],
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  bufferBytesPerSlice,
const std::vcl_size_t  destBytesPerLine,
const std::vcl_size_t  destBytesPerSlice,
const OpenCLEventList event_list = OpenCLEventList() 
)

Asynchronous version of the CopyToRect() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
CopyToRectAsync(), OpenCLEvent::IsComplete()

◆ CreateSubBuffer()

OpenCLBuffer itk::OpenCLBuffer::CreateSubBuffer ( const OpenCLMemoryObject::Access  access,
const std::vcl_size_t  size,
const std::vcl_size_t  offset = 0 
)

Creates a new buffer that refers to the size bytes, starting at offset within this buffer. The data in the new buffer will be accessed according to access. this function will return a null buffer.

See also
GetParentBuffer(), GetOffset()

◆ GetOffset()

std::vcl_size_t itk::OpenCLBuffer::GetOffset ( ) const

Returns the offset of this buffer within its parentBuffer() if it is a sub-buffer; zero otherwise.

See also
CreateSubBuffer(), GetParentBuffer()

◆ GetParentBuffer()

OpenCLBuffer itk::OpenCLBuffer::GetParentBuffer ( ) const

Returns the parent of this buffer if it is a sub-buffer; null otherwise.

See also
CreateSubBuffer(), GetOffset()

◆ Map() [1/2]

void * itk::OpenCLBuffer::Map ( const OpenCLMemoryObject::Access  access)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Maps the entire contents of this buffer into host memory for the specified access mode. Returns a pointer to the mapped region.

◆ Map() [2/2]

void * itk::OpenCLBuffer::Map ( const OpenCLMemoryObject::Access  access,
const std::vcl_size_t  size,
const std::vcl_size_t  offset = 0 
)

Maps the size bytes starting at offset in this buffer into host memory for the specified access mode. Returns a pointer to the mapped region. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
MapAsync(), Unmap()

◆ MapAsync()

OpenCLEvent itk::OpenCLBuffer::MapAsync ( void **  ptr,
const OpenCLMemoryObject::Access  access,
const std::vcl_size_t  size,
const OpenCLEventList event_list = OpenCLEventList(),
const std::vcl_size_t  offset = 0 
)

Asynchronous version of the Map() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
Map(), UnmapAsync(), OpenCLEvent::IsComplete()

◆ operator=()

OpenCLBuffer & itk::OpenCLBuffer::operator= ( const OpenCLBuffer other)

Assigns other to this object.

◆ Read()

bool itk::OpenCLBuffer::Read ( void *  data,
const std::vcl_size_t  size,
const std::vcl_size_t  offset = 0 
)

Reads size bytes starting at offset into the supplied data to the host memory. Returns true if the read was successful, false otherwise. This method does not return until the buffer data has been read into memory pointed to data.

See also
ReadAsync(), Write(), WriteAsync()

◆ ReadAsync()

OpenCLEvent itk::OpenCLBuffer::ReadAsync ( void *  data,
const std::vcl_size_t  size,
const OpenCLEventList event_list = OpenCLEventList(),
const std::vcl_size_t  offset = 0 
)

Asynchronous version of the Read() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
Read(), Write(), WriteAsync(), OpenCLEvent::IsComplete()

◆ ReadRect() [1/2]

bool itk::OpenCLBuffer::ReadRect ( void *  data,
const RectangleType rect,
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  hostBytesPerLine 
)

Reads the bytes defined by rect and bufferBytesPerLine from this buffer into the supplied data array, with a line pitch of hostBytesPerLine. Returns true if the read was successful, false otherwise. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
ReadRectAsync(), WriteRect()

◆ ReadRect() [2/2]

bool itk::OpenCLBuffer::ReadRect ( void *  data,
const std::vcl_size_t  origin[3],
const std::vcl_size_t  size[3],
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  bufferBytesPerSlice,
const std::vcl_size_t  hostBytesPerLine,
const std::vcl_size_t  hostBytesPerSlice 
)

Reads the bytes in the 3D region defined by origin, size, bufferBytesPerLine, and bufferBytesPerSlice from this buffer into the supplied data array, with a line pitch of hostBytesPerLine, and a slice pitch of hostBytesPerSlice. Returns true if the read was successful, false otherwise. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
ReadRectAsync(), WriteRect()

◆ ReadRectAsync() [1/2]

OpenCLEvent itk::OpenCLBuffer::ReadRectAsync ( void *  data,
const RectangleType rect,
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  hostBytesPerLine,
const OpenCLEventList event_list = OpenCLEventList() 
)

Asynchronous version of the ReadRect() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
ReadRect(), WriteRectAsync(), OpenCLEvent::IsComplete()

◆ ReadRectAsync() [2/2]

OpenCLEvent itk::OpenCLBuffer::ReadRectAsync ( void *  data,
const std::vcl_size_t  origin[3],
const std::vcl_size_t  size[3],
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  bufferBytesPerSlice,
const std::vcl_size_t  hostBytesPerLine,
const std::vcl_size_t  hostBytesPerSlice,
const OpenCLEventList event_list = OpenCLEventList() 
)

Asynchronous version of the ReadRect() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
ReadRect(), WriteRectAsync(), OpenCLEvent::IsComplete()

◆ Write()

bool itk::OpenCLBuffer::Write ( const void *  data,
const std::vcl_size_t  size,
const std::vcl_size_t  offset = 0 
)

Writes size bytes starting at offset from the supplied data to the device memory. Returns true if the write was successful, false otherwise. This function will block until the request finishes. This method does not return until the buffer data has been written into memory pointed to data.

See also
WriteAsync(), Read(), ReadAsync()

◆ WriteAsync()

OpenCLEvent itk::OpenCLBuffer::WriteAsync ( const void *  data,
const std::vcl_size_t  size,
const OpenCLEventList event_list = OpenCLEventList(),
const std::vcl_size_t  offset = 0 
)

Asynchronous version of the Write() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
Write(), Read(), ReadAsync(), OpenCLEvent::IsComplete()

◆ WriteRect() [1/2]

bool itk::OpenCLBuffer::WriteRect ( const void *  data,
const RectangleType rect,
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  hostBytesPerLine 
)

Writes the bytes at data, with a line pitch of hostBytesPerLine to the region of this buffer defined by rect and bufferBytesPerLine. Returns true if the write was successful, false otherwise. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
WriteRectAsync(), ReadRect()

◆ WriteRect() [2/2]

bool itk::OpenCLBuffer::WriteRect ( const void *  data,
const std::vcl_size_t  origin[3],
const std::vcl_size_t  size[3],
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  bufferBytesPerSlice,
const std::vcl_size_t  hostBytesPerLine,
const std::vcl_size_t  hostBytesPerSlice 
)

Writes the bytes at data, with a line pitch of hostBytesPerLine, and a slice pitch of hostBytesPerSlice, to the 3D region defined by origin, size, bufferBytesPerLine, and bufferBytesPerSlice in this buffer. Returns true if the write was successful, false otherwise. This function will block until the request finishes. The request is executed on the active command queue for context().

See also
WriteRectAsync(), ReadRect()

◆ WriteRectAsync() [1/2]

OpenCLEvent itk::OpenCLBuffer::WriteRectAsync ( const void *  data,
const RectangleType rect,
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  hostBytesPerLine,
const OpenCLEventList event_list = OpenCLEventList() 
)

Asynchronous version of the WriteRect() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
WriteRect(), ReadRectAsync(), OpenCLEvent::IsComplete()

◆ WriteRectAsync() [2/2]

OpenCLEvent itk::OpenCLBuffer::WriteRectAsync ( const void *  data,
const std::vcl_size_t  origin[3],
const std::vcl_size_t  size[3],
const std::vcl_size_t  bufferBytesPerLine,
const std::vcl_size_t  bufferBytesPerSlice,
const std::vcl_size_t  hostBytesPerLine,
const std::vcl_size_t  hostBytesPerSlice,
const OpenCLEventList event_list = OpenCLEventList() 
)

Asynchronous version of the WriteRect() method. This function will queue the request and return immediately. Returns an OpenCLEvent object that can be used to wait for the request to finish. The request will not start until all of the events in event_list have been signaled as completed.

See also
WriteRect(), ReadRectAsync(), OpenCLEvent::IsComplete()


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo