cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

bubu
Adept II

Way to get CL context for GL context?

Hi,

I want to perform tiled lighting for an OpenGL engine.

I have a restriction: must run in openGL 3.2 hardware, so I can't use OpenGL 4.3 compute shaders..... so the alternative is to use OpenCL.

The question is... given a OpenGL context, how can I get its associated CL context?

And pls, notice more than ONE GPUs can be installed in the system , so I need the associated context, not a shared one . For instance:

Imagine the user has a Intel Haswell IGP GPU and a Radeon 7770.

My engine gonna select the Radeon 7770 as main engine's render card. Now I render a frame and I get the ZBuffer to perform tiled lighting.

Now I'll fire a CL kernel to get the min/max Z per tile... BUT... obviously, I don't want this ZBuffer to be passed into the Haswell GPU or this will be terribly slow !

I need to stay in the Radeon 7770... So I must be sure the CL context corresponds to the GL context hardware!

So...given a OpenGL context, how can I get its associated CL context? And multiplaform solution ( linux,. mac, windows ), pls

thx

0 Likes
1 Solution
himanshu_gautam
Grandmaster

Checkout out section G of AMD OpenCL Programming Guide.

View solution in original post

0 Likes
2 Replies
nou
Exemplar

http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetGLContextInfoKHR.html with this you should be able to query cl_device for given OpenGL context.

0 Likes
himanshu_gautam
Grandmaster

Checkout out section G of AMD OpenCL Programming Guide.

0 Likes