We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I'm having trouble creating an OpenCL context from an OpenGL ES context on an Odroid XU3 running Android 4.4.4. The following code works fine on other non-ARM graphics hardware, but on the Mali chip the call to clCreateContextFromType fails with the error: "CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR (-1000)"
cl_context_properties contextProps[] = {
CL_CONTEXT_PLATFORM, cl_context_properties(m_platform),
CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(),
CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(),
0
};
clCreateContextFromType(contextProps, CL_DEVICE_TYPE_GPU, 0, &err);
We have checked the m_platform variable and the value is the correct platform id. Are there any special/additional steps in order to create the context, or is OpenCL/OpenGL interop not fully supported at this time on Android?
Thanks,
-Alex
Hi Sheri,
The symlinks for libOpenCL.so are:
libOpenCL.so -> libOpenCL.so.1
libOpenCL.so.1 -> libOpenCL.so.1.1
libOpenCL.so.1.1 -> /vendor/lib/egl/libGLES_mali.so
Without the -lEGL -lGLESv2 flags the build fails with undefined references for the egl* and gl* functions used in the project (for example eglGetCurrentContext)
Alex
Hi Alex,
That's odd: all the symbols are in libGLES_mali.so so it should work.
Can you try to create a symlink
/system/lib/libGLES_mali.so -> /vendor/lib/egl/libGLES_mali.so
And to link directly against libGLES_mali.so ?
Anthony
Do you get the same issues if you add -lGLES_mali as your first entry?
Kind Regards,
Michael McGeagh
Hi Anthony,
I have pulled libGLES_mali.so off the device, placed it in the ndk lib directory and replaced -lOpenCL -lEGL -lGLESv2 with -lGLES_mali as Michael indicated. This works! The shared context is created without error and CL/GL interop looks to be working.
Thank you all for your help,