OpenCL-ICD-Loader icon indicating copy to clipboard operation
OpenCL-ICD-Loader copied to clipboard

clCreateContext return unknown error code when create gl sharing context.

Open baixiaohub opened this issue 7 years ago • 1 comments

When I switch code from intel opencl sdk to the icd loader, the clCreateContext fails, but intel sdk works fine when calling clCreateContext with a GPU type device. If I call clCreateContext without gl sharing properties, icd loader works fine.

Sample code as below:

		cl_int err = CL_SUCCESS;
                //get nvidia platform and gpu type device omitted.
		cl_context_properties properties[] = {
			CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(),
			CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),
			CL_CONTEXT_PLATFORM, (cl_context_properties)targetPlatform,
			0 
		};
		cl::g_ctx = clCreateContext(properties, 1, &device, NULL, NULL, &err);//if call clCreateContext(NULL, 1, &device, NULL, NULL, &err); no error occur.
		CL_CHECK(err);//this err code is -9999.

My Environment is: windows 10, NVIDIA gtx1050ti with driver version R398.36 (r398_35-2) / 22.20.16.4735 (7-7-2017)

baixiaohub avatar Dec 10 '18 03:12 baixiaohub

@baixiaohub I am unable to see any issue in the code you have posted. Can you provide a full sample with detailed steps that I can follow to build and run on my machine? What steps are you following to switch between Intel SDK and this ICD loader?

Can you also try with the latest source in the OpenCL-ICD-Loader repository? Many fixes have went in recently so let's make sure we are using the latest version.

kepatil avatar Jan 26 '19 01:01 kepatil