title: Using clCreateSubBuffer
body: <p>I am trying to use create a subBuffer to read in a chunk of the buffer created from a 1-D vector. This is the code I am using:</p>
  
  <pre><code>d_treeArray = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_uint)*total,NULL,&amp;err);
  cl_buffer_region region;
  region.origin = 0; // This works
  //region.origin = 4; // This doesnt work
  region.size = 10*sizeof(cl_uint);
  d_subtreeArray = clCreateSubBuffer(d_treeArray,CL_MEM_READ_WRITE,CL_BUFFER_CREATE_TYPE_REGION, &amp;region, &amp;err);
  if(err != CL_SUCCESS) {
        std::cout &lt;&lt; "Cannot set buffers" &lt;&lt; std::endl;
        exit(1);
  }
  </code></pre>
  
  <p>Now when I give the region.origin as anything other than 0, I am getting -13 error (CL_INVALID_VALUE) which according to the help, means the region origin and size is out of bounds of the buffer. What might be the reason for this?</p>