Creating subbuffer objects

There may be situations when you may want to create a subbuffer out of the existing buffer object. For this purpose OpenCL provides the API.

cl_mem clCreateSubBuffer (cl_mem buffer,cl_mem_flags flags,cl_buffer_create_type buffer_create_type,const void *buffer_create_info,cl_int *errcode_ret)

The clCreateSubBuffer function can be used to create a new partial buffer object (referred to as a subbuffer object) from an existing OpenCL cl_mem buffer object.

Parameter name

Description

buffer

Must be a valid buffer object created using the clCreateBuffer API and cannot itself be a subbuffer object.

flags

This parameter takes the same values as described in the table of cl_mem_flags shown earlier. The values taken by the flags ...

Get OpenCL Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.