So I have a software architecture where I pick a differing GPU for each thread in my program and run OpenCL on each thread (and hence GPU) in parallel. So far so good. As you might imaging, not all GPUs are attached to the one driving the screen.
I'm on Win 7 (on Mac I have all this stuff working because MacOS abstracts a lot of this stuff)
Now I need to add OpenGL commands and OpenGL-OpenCL interop. All works okay if I created use CreateWindowEx and get the HDC for that window. And then use wglCreateContext, etc.
However, I want to make an OpenGL context for each of the GPUs separately. So I'm using WGL_AMD_GPU_association, and specifically wglCreateAssociatedContextAMD to create a context for each GPU available through WGL_AMD_GPU_association. As stated in the doc, I'm using wglMakeAssociatedContextCurrentAMD to set the OpenGL context instead of wglMakeCurrent, because as the AMD docs say, there is no HDC per se.
Now my dilemma, I want to associate each of the HGLRC made with wglCreateAssociatedContextAMD creating a context with clCreateContext. First I call wglCreateAssociatedContextAMD... then I call clGetGLContextInfo for the information: CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR. I make sure the cl_device_id returned there matches the device I'm getting to create a cl_context for. In the call to clCreateContext set the properties CL_CONTEXT_PLATFORM to the proper cl_platform, CL_GL_CONTEXT_KHR to the HGLRC created with wglCreateAssociatedContextAMD.
For CL_WGL_HDC_KHR I've tried two things: first after calling wglMakeAssociatedContextCurrentAMD, I call wglCurrentDC() (which before the call to wglMakeAssociatedContextCurrentAMD was NULL, for the purposed of this discussion), and I've also tried setting it to NULL. I've also tried leaving the CL_GL_CONTEXT_KHR descriptor out of the equation. All cases return to me the error CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR.
Is OpenGL-OpenCL interop supported on GL contexts made with wglCreateAssociatedContextAMD?