Problems with clCreateSubBuffer and clCreateFromGLBuffer

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?



//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;


Hi, I know that this topic is a little bit old, but i stumbled on it while trying to solve the exact same problem.
In my specific situation, the same code works fine on an AMD card, but it fails on a NVIDIA one, giving CL_INVALID_VALUE when I try to create a sub buffer from a buffer obtained with clCreateFromGLBuffer.
Maybe you have fixed it? Or does it ring a bell into someone else’s head?