cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

douglas125
Adept I

CLGL Interop problem

Can't get CLGL interop to work

Hi;

 

I tried installing AMD APP SDK 2.4 but then I couldn't get CLGL interoperation to work anymore.

I switched back to 2.3 and it works again. The error message I get is OutOfResources both when interoperating with textures and VBOs.

I tried this using win7 64 bits, catalyst 11.4 AND 11.3, Juniper GPU (5770). Maybe I could have failed to uninstall properly previous drivers?

The path to the code that didn't work is http://www.cmsoft.com.br/tutorialOpenCL/CLGLInteropTextures.zip

I'm using C# Cloo bindings for the interoperation.

I would like some advice since the code works for NVidia and SDK 2.3.

0 Likes
7 Replies
nou
Exemplar

well do you create OpenGL objects after a OpenCl context creation? see release notes section 7.4

For OpenGL interoperability with OpenCL, there currently is a requirement on when the
OpenCL context is created and when texture/buffer shared allocations can be made. To use
shared resources, the OpenGL application must create an OpenGL context and then an
OpenCL context. All resources (GL buffers and textures) created after creation of the OpenCL
context can be shared between OpenGL and OpenCL. If resources are allocated before the
OpenCL context creation, they cannot be shared between OpenGL and OpenCL.

0 Likes

Yes, I create the OpenCL context before creating the OpenGL objects.

To ellaborate, this is the order of operations:

1. Create OpenGL context (using OpenTK);
2. Create derived OpenCL context;
3. Create OpenGL VBOs;
4. Create OpenCL buffers from GL objects;
5. Use AcquireGLElements to modify buffers - throws OutOfResources.

I included some of the code I'm using. The problem is that the exception thrown at AcquireGLElements doesn't help track the problem...

//**************************** //OpenCL context creation IntPtr curDC = wglGetCurrentDC(); OpenTK.Graphics.IGraphicsContextInternal ctx = (OpenTK.Graphics.IGraphicsContextInternal)OpenTK.Graphics.GraphicsContext.CurrentContext; IntPtr raw_context_handle = ctx.Context.Handle; ComputeContextProperty p1 = new ComputeContextProperty(ComputeContextPropertyName.CL_GL_CONTEXT_KHR, raw_context_handle); ComputeContextProperty p2 = new ComputeContextProperty(ComputeContextPropertyName.CL_WGL_HDC_KHR, curDC); ComputeContextProperty p3 = new ComputeContextProperty(ComputeContextPropertyName.Platform, ComputePlatform.Platforms[0].Handle.Value); List<ComputeContextProperty> props = new List<ComputeContextProperty>() { p1, p2, p3 }; CLGLCtx = new ComputeContext(ComputeDeviceTypes.Gpu, Properties, null, IntPtr.Zero); //**************************** //Set VBO - all vbos created like this GL.BindBuffer(BufferTarget.ArrayBuffer, GLVertexBuffer); GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(VertexData.Length * sizeof(float)), VertexData, Hint); //**************************** //Creates from OpenGL buffer - this Context is the shared context ClooBuffer = ComputeBuffer<float>.CreateFromGLBuffer<float>(CLCalc.Program.Context, ComputeMemoryFlags.ReadWrite, GLBuffer);

0 Likes

Hi Douglas,

Can you please post your system configuration: CPU,GPU,DRIVER, SDK, OS and GL version.

Are you able to run CLGL samples from the SDK(Try SimpleGL).

0 Likes

Sure:

 

CPU - AMD Phenom 9950 quad 2.6Ghz
GPU - HD Radeon 5770

Win7 System Information:
Driver version - 8.840.2.0
Driver - atikmpag.sys 8.14.6203
OS - Win7 Home Premium 64 bits

Catalyst 11.4
OpenGL 6.14.10.10664

SimpleGL runs fine....

What puzzles me is that it worked with the previous version of the APP SDK (2.3)....

 

EDIT: Tried again with Catalyst 11.3; doesn't work either. I reverted back and it works again. I would kindly ask any of you to try running the app to check if it works with APP 2.4 or if it's just here...

Besides, the error appears in clAcquireGLElements which confuses me even more.

0 Likes
sharpneli
Adept I

We have similar issues. With APP SDK 2.3 everything worked fine and now (with 2.4) the results are, undefined to say the least. Basically we have vbo with DYNAMIC_DRAW and the cl mem object is read/write. We just want to draw array of gl points to the screen. With intel's opencl implementation everything still works so the culprit seems to be amd:s opencl part.

We do not get any out of resources or any errors at all. The draw call just seems to draw the first point and nothing else after that. If we transfer the data to host buffer (from the vbo) via OpenCL commands and then draw them using gl_begin everything is ok, so the data in the vbo is not corrupted.

0 Likes

sharpneli,

Can you post your code and system details.

If possible give the C/C++ binding run rime code.

You can also file a ticket for this.

0 Likes

I was able to break the SimpleGL example by removing the clWaitForEvents after the kernel call. The waitforevents ought to be unnecessary as only thing the standard mandates is clFinish after clEnqueueReleaseGl.

The example does not crash or anything. It simply does not display anything on the screen.

As for our code it is almost identical to the simplegl regarding the interoperability part except that we both read and write from the vbo.

0 Likes