cf4ocl (C Framework for OpenCL)  v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Buffer wrapper

The buffer wrapper module provides functionality for simple handling of OpenCL buffer objects. More...

Macros

#define ccl_buffer_enqueue_unmap(buf, cq, ptr, ewl, err)   ccl_memobj_enqueue_unmap((CCLMemObj*) buf, cq, ptr, ewl, err)
 Enqueues a command to unmap a previously mapped buffer object. More...
 
#define ccl_buffer_enqueue_unmap(buf, cq, ptr, ewl, err)   ccl_memobj_enqueue_unmap((CCLMemObj*) buf, cq, ptr, ewl, err)
 Enqueues a command to unmap a previously mapped buffer object. More...
 
#define ccl_buffer_ref(buf)   ccl_wrapper_ref((CCLWrapper*) buf)
 Increase the reference count of the buffer wrapper object. More...
 
#define ccl_buffer_ref(buf)   ccl_wrapper_ref((CCLWrapper*) buf)
 Increase the reference count of the buffer wrapper object. More...
 
#define ccl_buffer_unref(buf)   ccl_buffer_destroy(buf)
 Alias to ccl_buffer_destroy(). More...
 
#define ccl_buffer_unref(buf)   ccl_buffer_destroy(buf)
 Alias to ccl_buffer_destroy(). More...
 
#define ccl_buffer_unwrap(buf)   ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) buf))
 Get the OpenCL buffer object. More...
 
#define ccl_buffer_unwrap(buf)   ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) buf))
 Get the OpenCL buffer object. More...
 

Typedefs

typedef struct ccl_buffer CCLBuffer
 Buffer wrapper class.
 

Functions

void ccl_buffer_destroy (CCLBuffer *buf)
 Decrements the reference count of the wrapper object. More...
 
CCLEventccl_buffer_enqueue_copy (CCLBuffer *src_buf, CCLBuffer *dst_buf, CCLQueue *cq, size_t src_offset, size_t dst_offset, size_t size, CCLEventWaitList *evt_wait_lst, CCLErr **err)
 Copy from one buffer object to another. More...
 
CCLEventccl_buffer_enqueue_copy_rect (CCLBuffer *src_buf, CCLBuffer *dst_buf, CCLQueue *cq, const size_t *src_origin, const size_t *dst_origin, const size_t *region, size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch, size_t dst_slice_pitch, CCLEventWaitList *evt_wait_lst, CCLErr **err)
 Copy a 2D or 3D rectangular region from a buffer object to another buffer object. More...
 
CCLEventccl_buffer_enqueue_copy_to_image (CCLBuffer *src_buf, CCLImage *dst_img, CCLQueue *cq, size_t src_offset, const size_t *dst_origin, const size_t *region, CCLEventWaitList *evt_wait_lst, CCLErr **err)
 Copy a buffer object to an image object. More...
 
CCLEventccl_buffer_enqueue_fill (CCLBuffer *buf, CCLQueue *cq, const void *pattern, size_t pattern_size, size_t offset, size_t size, CCLEventWaitList *evt_wait_lst, CCLErr **err)
 Fill a buffer object with a pattern of a given pattern size. More...
 
void * ccl_buffer_enqueue_map (CCLBuffer *buf, CCLQueue *cq, cl_bool blocking_map, cl_map_flags map_flags, size_t offset, size_t size, CCLEventWaitList *evt_wait_lst, CCLEvent **evt, CCLErr **err)
 Map a region of a buffer into the host address space and return a pointer to this mapped region. More...
 
CCLEventccl_buffer_enqueue_read (CCLBuffer *buf, CCLQueue *cq, cl_bool blocking_read, size_t offset, size_t size, void *ptr, CCLEventWaitList *evt_wait_lst, CCLErr **err)
 Read from a buffer object to host memory. More...
 
CCLEventccl_buffer_enqueue_read_rect (CCLBuffer *buf, CCLQueue *cq, cl_bool blocking_read, const size_t *buffer_origin, const size_t *host_origin, const size_t *region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, void *ptr, CCLEventWaitList *evt_wait_lst, CCLErr **err)
 Read from a 2D or 3D rectangular region from a buffer object to host memory. More...
 
CCLEventccl_buffer_enqueue_write (CCLBuffer *buf, CCLQueue *cq, cl_bool blocking_write, size_t offset, size_t size, void *ptr, CCLEventWaitList *evt_wait_lst, CCLErr **err)
 Write to a buffer object from host memory. More...
 
CCLEventccl_buffer_enqueue_write_rect (CCLBuffer *buf, CCLQueue *cq, cl_bool blocking_write, const size_t *buffer_origin, const size_t *host_origin, const size_t *region, size_t buffer_row_pitch, size_t buffer_slice_pitch, size_t host_row_pitch, size_t host_slice_pitch, void *ptr, CCLEventWaitList *evt_wait_lst, CCLErr **err)
 Write a 2D or 3D rectangular region to a buffer object from host memory. More...
 
CCLBufferccl_buffer_new (CCLContext *ctx, cl_mem_flags flags, size_t size, void *host_ptr, CCLErr **err)
 Create a CCLBuffer wrapper object. More...
 
CCLBufferccl_buffer_new_from_region (CCLBuffer *buf, cl_mem_flags flags, size_t origin, size_t size, CCLErr **err)
 Creates a sub-buffer that represents a specific region in the given buffer. More...
 
CCLBufferccl_buffer_new_wrap (cl_mem mem_object)
 Get the buffer wrapper for the given OpenCL buffer. More...
 

Detailed Description

The buffer wrapper module provides functionality for simple handling of OpenCL buffer objects.

All the functions in this module are direct wrappers of the respective OpenCL buffer functions, except for the ccl_buffer_new_from_region() function. This function wraps clCreateSubBuffer() but assumes that the sub-buffer will represent a specific region in the original buffer (which is the only sub-buffer type, up to OpenCL 2.1).

Buffer wrapper objects can be directly passed as kernel arguments to functions such as ccl_kernel_set_args_and_enqueue_ndrange() or ccl_kernel_set_args_v().

Information about buffer objects can be fetched using the info macros from the memory object module:

Instantiation and destruction of buffer wrappers follows the cf4ocl new/destroy rule.

Example:

CCLBuffer* buf;
cl_float host_data[BSIZE];
size_t buf_size = BSIZE * sizeof(cl_float);
context, CL_MEM_READ_WRITE, buf_size, NULL, NULL);
ccl_buffer_enqueue_write(queue, buf, CL_TRUE, 0, buf_size,
host_data, NULL, NULL);
ccl_buffer_enqueue_read(queue, buf, CL_TRUE, 0, buf_size,
host_data, NULL, NULL);

Macro Definition Documentation

#define ccl_buffer_enqueue_unmap (   buf,
  cq,
  ptr,
  ewl,
  err 
)    ccl_memobj_enqueue_unmap((CCLMemObj*) buf, cq, ptr, ewl, err)

Enqueues a command to unmap a previously mapped buffer object.

This is a utility macro that expands to ccl_memobj_enqueue_unmap(), casting buf into a CCLMemObj object.

Parameters
[in]bufA buffer wrapper object.
[in]cqA command queue wrapper object.
[in]ptrThe host address returned by a previous call to ccl_buffer_enqueue_map().
[in,out]ewlList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this command.

Definition at line 199 of file ccl_buffer_wrapper.h.

#define ccl_buffer_enqueue_unmap (   buf,
  cq,
  ptr,
  ewl,
  err 
)    ccl_memobj_enqueue_unmap((CCLMemObj*) buf, cq, ptr, ewl, err)

Enqueues a command to unmap a previously mapped buffer object.

This is a utility macro that expands to ccl_memobj_enqueue_unmap(), casting buf into a CCLMemObj object.

Parameters
[in]bufA buffer wrapper object.
[in]cqA command queue wrapper object.
[in]ptrThe host address returned by a previous call to ccl_buffer_enqueue_map().
[in,out]ewlList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this command.

Definition at line 199 of file ccl_buffer_wrapper.h.

#define ccl_buffer_ref (   buf)    ccl_wrapper_ref((CCLWrapper*) buf)

Increase the reference count of the buffer wrapper object.

Parameters
[in]bufThe buffer wrapper object.

Definition at line 207 of file ccl_buffer_wrapper.h.

#define ccl_buffer_ref (   buf)    ccl_wrapper_ref((CCLWrapper*) buf)

Increase the reference count of the buffer wrapper object.

Parameters
[in]bufThe buffer wrapper object.

Definition at line 207 of file ccl_buffer_wrapper.h.

#define ccl_buffer_unref (   buf)    ccl_buffer_destroy(buf)

Alias to ccl_buffer_destroy().

Parameters
[in]bufBuffer wrapper object to unreference.

Definition at line 215 of file ccl_buffer_wrapper.h.

#define ccl_buffer_unref (   buf)    ccl_buffer_destroy(buf)

Alias to ccl_buffer_destroy().

Parameters
[in]bufBuffer wrapper object to unreference.

Definition at line 215 of file ccl_buffer_wrapper.h.

#define ccl_buffer_unwrap (   buf)    ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) buf))

Get the OpenCL buffer object.

Parameters
[in]bufThe buffer wrapper object.
Returns
The OpenCL buffer object.

Definition at line 223 of file ccl_buffer_wrapper.h.

#define ccl_buffer_unwrap (   buf)    ((cl_mem) ccl_wrapper_unwrap((CCLWrapper*) buf))

Get the OpenCL buffer object.

Parameters
[in]bufThe buffer wrapper object.
Returns
The OpenCL buffer object.

Definition at line 223 of file ccl_buffer_wrapper.h.

Function Documentation

void ccl_buffer_destroy ( CCLBuffer buf)

Decrements the reference count of the wrapper object.

If it reaches 0, the wrapper object is destroyed.

Parameters
[in]bufThe buffer wrapper object.
Examples:
canon.c.

Definition at line 88 of file ccl_buffer_wrapper.c.

CCLEvent * ccl_buffer_enqueue_copy ( CCLBuffer src_buf,
CCLBuffer dst_buf,
CCLQueue cq,
size_t  src_offset,
size_t  dst_offset,
size_t  size,
CCLEventWaitList evt_wait_lst,
CCLErr **  err 
)

Copy from one buffer object to another.

This function wraps the clEnqueueCopyBuffer() OpenCL function.

Parameters
[in]src_bufSource buffer wrapper object where to read from.
[out]dst_bufDestination buffer wrapper object where to write to.
[in]cqCommand-queue wrapper object in which the copy command will be queued.
[in]src_offsetThe offset where to begin copying data from src_buffer.
[in]dst_offsetThe offset where to begin copying data into dst_buffer.
[in]sizeSize in bytes to copy.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this copy command.

Definition at line 408 of file ccl_buffer_wrapper.c.

CCLEvent * ccl_buffer_enqueue_copy_rect ( CCLBuffer src_buf,
CCLBuffer dst_buf,
CCLQueue cq,
const size_t *  src_origin,
const size_t *  dst_origin,
const size_t *  region,
size_t  src_row_pitch,
size_t  src_slice_pitch,
size_t  dst_row_pitch,
size_t  dst_slice_pitch,
CCLEventWaitList evt_wait_lst,
CCLErr **  err 
)

Copy a 2D or 3D rectangular region from a buffer object to another buffer object.

This function wraps the clEnqueueCopyBufferRect() OpenCL function.

Note
Requires OpenCL >= 1.1
Parameters
[in]src_bufSource buffer wrapper object where to read from.
[out]dst_bufDestination buffer wrapper object where to write to.
[in]cqCommand-queue wrapper object in which the copy command will be queued.
[in]src_originThe $(x, y, z)$ offset in memory associated with src_buf.
[in]dst_originThe $(x, y, z)$ offset in memory associated with dst_buf.
[in]regionThe (width in bytes, height in rows, depth in slices) of the 2D or 3D rectangle being copied.
[in]src_row_pitchThe length of each row in bytes to be used for the memory region associated with src_buf.
[in]src_slice_pitchThe length of each 2D slice in bytes to be used for the memory region associated with src_buf.
[in]dst_row_pitchThe length of each row in bytes to be used for the memory region associated with dst_buf.
[in]dst_slice_pitchThe length of each 2D slice in bytes to be used for the memory region associated with dst_buf.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this copy command.

Definition at line 972 of file ccl_buffer_wrapper.c.

CCLEvent * ccl_buffer_enqueue_copy_to_image ( CCLBuffer src_buf,
CCLImage dst_img,
CCLQueue cq,
size_t  src_offset,
const size_t *  dst_origin,
const size_t *  region,
CCLEventWaitList evt_wait_lst,
CCLErr **  err 
)

Copy a buffer object to an image object.

This function wraps the clEnqueueCopyBufferToImage() OpenCL function.

Parameters
[in]src_bufSource buffer wrapper object where to read from.
[out]dst_imgDestination image wrapper object where to write to.
[in]cqCommand-queue wrapper object in which the copy command will be queued.
[in]src_offsetThe offset where to begin copying data from src_buffer.
[in]dst_originDefines the $(x, y, z)$ offset in pixels in the 1D, 2D or 3D image, the $(x, y)$ offset and the image index in the 2D image array or the $(x)$ offset and the image index in the 1D image array.
[in]regionThe $(width, height, depth)$ in pixels of the 1D, 2D or 3D rectangle, the $(width, height)$ in pixels of the 2D rectangle and the number of images of a 2D image array or the $(width)$ in pixels of the 1D rectangle and the number of images of a 1D image array.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this copy command.

Definition at line 492 of file ccl_buffer_wrapper.c.

CCLEvent * ccl_buffer_enqueue_fill ( CCLBuffer buf,
CCLQueue cq,
const void *  pattern,
size_t  pattern_size,
size_t  offset,
size_t  size,
CCLEventWaitList evt_wait_lst,
CCLErr **  err 
)

Fill a buffer object with a pattern of a given pattern size.

This function wraps the clEnqueueFillBuffer() OpenCL function.

Note
Requires OpenCL >= 1.2
Parameters
[out]bufBuffer wrapper object to fill.
[in]cqCommand-queue wrapper object in which the fill command will be queued.
[in]patternA pointer to the data pattern.
[in]pattern_sizeSize of data pattern in bytes.
[in]offsetThe location in bytes of the region being filled in buffer and must be a multiple of pattern_size.
[in]sizeThe size in bytes of region being filled in buffer. Must be a multiple of pattern_size.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this fill command.

Definition at line 1100 of file ccl_buffer_wrapper.c.

void * ccl_buffer_enqueue_map ( CCLBuffer buf,
CCLQueue cq,
cl_bool  blocking_map,
cl_map_flags  map_flags,
size_t  offset,
size_t  size,
CCLEventWaitList evt_wait_lst,
CCLEvent **  evt,
CCLErr **  err 
)

Map a region of a buffer into the host address space and return a pointer to this mapped region.

This function wraps the clEnqueueMapBuffer() OpenCL function.

Parameters
[in,out]bufBuffer wrapper object to be mapped.
[in]cqCommand-queue wrapper object in which the map command will be queued.
[in]blocking_mapIndicates if the map operation is blocking or non-blocking.
[in]map_flagsFlags which specify the type of mapping to perform.
[in]offsetThe offset in bytes in the buffer object that is being mapped.
[in]sizeThe size of the region in the buffer object that is being mapped.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]evtAn event wrapper object that identifies this particular map command. If NULL, no event will be returned.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
A pointer in the host address space for the mapped region.

Definition at line 328 of file ccl_buffer_wrapper.c.

CCLEvent * ccl_buffer_enqueue_read ( CCLBuffer buf,
CCLQueue cq,
cl_bool  blocking_read,
size_t  offset,
size_t  size,
void *  ptr,
CCLEventWaitList evt_wait_lst,
CCLErr **  err 
)

Read from a buffer object to host memory.

This function wraps the clEnqueueReadBuffer() OpenCL function.

Parameters
[in]bufBuffer wrapper object where to read from.
[in]cqCommand-queue wrapper object in which the read command will be queued.
[in]blocking_readIndicates if the read operations are blocking or non-blocking.
[in]offsetThe offset in bytes in the buffer object to read from.
[in]sizeThe size in bytes of data being read.
[out]ptrThe pointer to buffer in host memory where data is to be read into.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this read command.
Examples:
canon.c.

Definition at line 175 of file ccl_buffer_wrapper.c.

CCLEvent * ccl_buffer_enqueue_read_rect ( CCLBuffer buf,
CCLQueue cq,
cl_bool  blocking_read,
const size_t *  buffer_origin,
const size_t *  host_origin,
const size_t *  region,
size_t  buffer_row_pitch,
size_t  buffer_slice_pitch,
size_t  host_row_pitch,
size_t  host_slice_pitch,
void *  ptr,
CCLEventWaitList evt_wait_lst,
CCLErr **  err 
)

Read from a 2D or 3D rectangular region from a buffer object to host memory.

This function wraps the clEnqueueReadBufferRect() OpenCL function.

Note
Requires OpenCL >= 1.1
Parameters
[in]bufBuffer wrapper object where to read from.
[in]cqCommand-queue wrapper object in which the read command will be queued.
[in]blocking_readIndicates if the read operations are blocking or non-blocking.
[in]buffer_originThe $(x, y, z)$ offset in the memory region associated with buffer.
[in]host_originThe $(x, y, z)$ offset in the memory region pointed to by ptr.
[in]regionThe (width in bytes, height in rows, depth in slices) of the 2D or 3D rectangle being read or written.
[in]buffer_row_pitchThe length of each row in bytes to be used for the memory region associated with buffer.
[in]buffer_slice_pitchThe length of each 2D slice in bytes to be used for the memory region associated with buffer.
[in]host_row_pitchThe length of each row in bytes to be used for the memory region pointed to by ptr.
[in]host_slice_pitchThe length of each 2D slice in bytes to be used for the memory region pointed to by ptr.
[out]ptrThe pointer to buffer in host memory where data is to be read into.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this read command.

Definition at line 690 of file ccl_buffer_wrapper.c.

CCLEvent * ccl_buffer_enqueue_write ( CCLBuffer buf,
CCLQueue cq,
cl_bool  blocking_write,
size_t  offset,
size_t  size,
void *  ptr,
CCLEventWaitList evt_wait_lst,
CCLErr **  err 
)

Write to a buffer object from host memory.

This function wraps the clEnqueueWriteBuffer() OpenCL function.

Parameters
[out]bufBuffer wrapper object where to write to.
[in]cqCommand-queue wrapper object in which the write command will be queued.
[in]blocking_writeIndicates if the write operations are blocking or non-blocking.
[in]offsetThe offset in bytes in the buffer object to read from.
[in]sizeThe size in bytes of data being read.
[in]ptrThe pointer to buffer in host memory where data is to be written from.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this write command, or NULL if an error occurs.
Examples:
canon.c.

Definition at line 250 of file ccl_buffer_wrapper.c.

CCLEvent * ccl_buffer_enqueue_write_rect ( CCLBuffer buf,
CCLQueue cq,
cl_bool  blocking_write,
const size_t *  buffer_origin,
const size_t *  host_origin,
const size_t *  region,
size_t  buffer_row_pitch,
size_t  buffer_slice_pitch,
size_t  host_row_pitch,
size_t  host_slice_pitch,
void *  ptr,
CCLEventWaitList evt_wait_lst,
CCLErr **  err 
)

Write a 2D or 3D rectangular region to a buffer object from host memory.

This function wraps the clEnqueueWriteBufferRect() OpenCL function.

Note
Requires OpenCL >= 1.1
Parameters
[out]bufBuffer wrapper object where to write to.
[in]cqCommand-queue wrapper object in which the write command will be queued.
[in]blocking_writeIndicates if the write operations are blocking or non-blocking.
[in]buffer_originThe $(x, y, z)$ offset in the memory region associated with buffer.
[in]host_originThe $(x, y, z)$ offset in the memory region pointed to by ptr.
[in]regionThe (width in bytes, height in rows, depth in slices) of the 2D or 3D rectangle being read or written.
[in]buffer_row_pitchThe length of each row in bytes to be used for the memory region associated with buffer.
[in]buffer_slice_pitchThe length of each 2D slice in bytes to be used for the memory region associated with buffer.
[in]host_row_pitchThe length of each row in bytes to be used for the memory region pointed to by ptr.
[in]host_slice_pitchThe length of each 2D slice in bytes to be used for the memory region pointed to by ptr.
[in]ptrThe pointer to buffer in host memory where data is to be written from.
[in,out]evt_wait_lstList of events that need to complete before this command can be executed. The list will be cleared and can be reused by client code.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
Event wrapper object that identifies this write command, or NULL if an error occurs.

Definition at line 833 of file ccl_buffer_wrapper.c.

CCLBuffer * ccl_buffer_new ( CCLContext ctx,
cl_mem_flags  flags,
size_t  size,
void *  host_ptr,
CCLErr **  err 
)

Create a CCLBuffer wrapper object.

Parameters
[in]ctxContext wrapper.
[in]flagsOpenCL memory flags.
[in]sizeThe size in bytes of the buffer memory object to be allocated.
[in]host_ptrA pointer to the buffer data that may already be allocated by the application. The size of the buffer that host_ptr points to must be >= size bytes.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
A new wrapper object.
Examples:
canon.c.

Definition at line 113 of file ccl_buffer_wrapper.c.

CCLBuffer * ccl_buffer_new_from_region ( CCLBuffer buf,
cl_mem_flags  flags,
size_t  origin,
size_t  size,
CCLErr **  err 
)

Creates a sub-buffer that represents a specific region in the given buffer.

This function wraps the clCreateSubBuffer() OpenCL function.

Note
Requires OpenCL >= 1.1
Parameters
[in]bufA buffer wrapper object which cannot represent a sub-buffer.
[in]flagsAllocation and usage information about the sub-buffer memory object.
[in]originOffset relative to the parent buffer.
[in]sizeSub-buffer size.
[out]errReturn location for a CCLErr object, or NULL if error reporting is to be ignored.
Returns
A new buffer wrapper object which represents a specific region in the original buffer.

Definition at line 569 of file ccl_buffer_wrapper.c.

CCLBuffer * ccl_buffer_new_wrap ( cl_mem  mem_object)
protected

Get the buffer wrapper for the given OpenCL buffer.

If the wrapper doesn't exist, its created with a reference count of 1. Otherwise, the existing wrapper is returned and its reference count is incremented by 1.

This function will rarely be called from client code, except when clients wish to directly wrap an OpenCL buffer in a CCLBuffer wrapper object.

Parameters
[in]mem_objectThe OpenCL buffer to be wrapped.
Returns
The CCLBuffer wrapper for the given OpenCL buffer.

Definition at line 72 of file ccl_buffer_wrapper.c.