Read GL depth buffer from OpenCL?

I want to do some post-processing on a OpenGL depth buffer with OpenCL.

However, AFAICT, OpenCL can’t do this. Is this true? If so, what’s the simplest way to shim this so OpenCL will work?

BACKGROUND:

clCreateFromGLTexture2D only honors cl_image_format formats, which are essentially only RGBA (color) formats. Any attempt to use a depth texture results in CL_INVALID_GL_OBJECT, even if you pass a GL_DEPTH_COMPONENT32F texture (component type GL_FLOAT, which is supported). So a depth texture is apparently out.

And clCreateFromGLRenderbuffer says it “too” only handles RGBA-based (color) internal formats. Here’s a guy that tried that last year and met with failure: link

What’s a poor developer to do?

That’s a good question. I’m not an expert on CL/GL interop, but as far as I understand you are out of luck. Sorry.

Ok, thanks. I was hoping to get out of writing a redundant FLOAT color channel, doubling my write bandwidth, just to use OpenCL for this.