You are right as I want something more flexible and generic. Using clCreateSubBuffer can be an option but I am having problem with using it. Maybe, I am missing something:
cl_buffer_region *info= new cl_buffer_region();
info->size= (size_t)8;//in bytes for float
info->origin=(size_t)0; // in bytes for float
newBuffer = clCreateSubBuffer (newDevicePointer,CL_MEM_READ_WRITE, CL_BUFFER_CREATE_TYPE_REGION, info, NULL); //Segmentation fault
Last line gives me segmentation fault and I don’t know why and there is no help about it out there. I have ensured that parent buffer is not a subbuffer and other constraints but still, no clue.
Have someone used clCreateSubBuffer or know about this problems?