When I use clCreateSubBuffer on a purely CL buffer, the operation works just fine. But when I use clCreateSubBuffer on a buffer that is created from a GL buffer, it fails with the CL_INVALID_VALUE error code. Any ideas?


Code :
 
//create the cl buffer
cl_mem clData = clCreateBuffer(clGPUContext, CL_MEM_WRITE_ONLY, size, NULL, &clError);
if (clError != CL_SUCCESS) 
	std::cout << "could not put data into cl buffer" << std::endl;
 
//create cl buffer from gl buffer
cl_mem clFromGL = clCreateFromGLBuffer(clGPUContext, CL_MEM_WRITE_ONLY, glBufferObject, &clError);
if (clError != CL_SUCCESS)
        std::cout << "could not convert GL indirect command buffer buffer to a CL buffer" << std::endl;
 
 
BufferRegionCL buffRegion;
buffRegion.origin = 0;
buffRegion.size = sizeof(cl_float);
 
//THIS SUCCEEDS
cl_mem subMem = clCreateSubBuffer(clData, CL_MEM_WRITE_ONLY, CL_BUFFER_CREATE_TYPE_REGION, &buffRegion, &clError); 
if (clError != CL_SUCCESS)
	std::cout << "could not create sub buffer from the cl buffer" << std::endl;
 
//THIS FAILS
cl_mem subMem = clCreateSubBuffer(clFromGL, CL_MEM_WRITE_ONLY, CL_BUFFER_CREATE_TYPE_REGION, &buffRegion, &clError); 
if (clError != CL_SUCCESS)
	std::cout << "could not create sub buffer from the cl/gl buffer" << std::endl;