diff --git a/pyopencl/tools.py b/pyopencl/tools.py index 74f29dbf8c8d41d4768796f9d3bf2db617a570c1..0bdfa292600a6f7fb6f824a293316d585ba8f309 100644 --- a/pyopencl/tools.py +++ b/pyopencl/tools.py @@ -271,7 +271,7 @@ def get_gl_sharing_context_properties(): WGL.wglGetCurrentDC())) elif sys.platform == "darwin": props.append( - (ctx_props.CGL_SHAREGROUP, cl.get_apple_cgl_share_group())) + (ctx_props.CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, cl.get_apple_cgl_share_group())) else: raise NotImplementedError("platform '%s' not yet supported" % sys.platform) @@ -280,5 +280,4 @@ def get_gl_sharing_context_properties(): - # vim: foldmethod=marker diff --git a/src/wrapper/wrap_cl.hpp b/src/wrapper/wrap_cl.hpp index cd5a6a9197f5c26a7949bcf85253bd17ec163c21..8df73a23c73f2a045140fd440d11c95e9df690c4 100644 --- a/src/wrapper/wrap_cl.hpp +++ b/src/wrapper/wrap_cl.hpp @@ -6,10 +6,11 @@ #ifdef __APPLE__ // Mac ------------------------------------------------------------------------ -#include <OpenCL/cl.h> -#include <OpenCL/cl_ext.h> - +#include <OpenCL/opencl.h> #ifdef HAVE_GL + +#define PYOPENCL_GL_SHARING_VERSION 1 + #include <OpenGL/OpenGL.h> #include <OpenCL/cl_gl.h> #include <OpenCL/cl_gl_ext.h> @@ -17,6 +18,10 @@ #else +#if defined(cl_khr_gl_sharing) && (cl_khr_gl_sharing >= 1) +#define PYOPENCL_GL_SHARING_VERSION cl_khr_gl_sharing +#endif + // elsewhere ------------------------------------------------------------------ #include <CL/cl.h> // TBD: Nvidia used to not install cl_ext.h by default. Grr. @@ -654,16 +659,20 @@ namespace pyopencl break; } -#if defined(cl_khr_gl_sharing) && (cl_khr_gl_sharing >= 1) +#if defined(PYOPENCL_GL_SHARING_VERSION) && (PYOPENCL_GL_SHARING_VERSION >= 1) +#if defined(__APPLE__) && defined(HAVE_GL) + case CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE: +#else case CL_GL_CONTEXT_KHR: case CL_EGL_DISPLAY_KHR: case CL_GLX_DISPLAY_KHR: case CL_WGL_HDC_KHR: case CL_CGL_SHAREGROUP_KHR: +#endif value = py::object(result[i+1]); break; -#endif +#endif case 0: break; @@ -714,7 +723,7 @@ namespace pyopencl props.push_back( reinterpret_cast<cl_context_properties>(value().data())); } -#if defined(cl_khr_gl_sharing) && (cl_khr_gl_sharing >= 1) +#if defined(PYOPENCL_GL_SHARING_VERSION) && (PYOPENCL_GL_SHARING_VERSION >= 1) #if defined(_WIN32) else if (prop == CL_WGL_HDC_KHR) { @@ -727,6 +736,9 @@ namespace pyopencl || prop == CL_EGL_DISPLAY_KHR || prop == CL_GLX_DISPLAY_KHR || prop == CL_CGL_SHAREGROUP_KHR +#if defined(__APPLE__) && defined(HAVE_GL) + || prop == CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE +#endif ) { py::object ctypes = py::import("ctypes"); @@ -2958,7 +2970,7 @@ namespace pyopencl -#if defined(cl_khr_gl_sharing) && (cl_khr_gl_sharing >= 1) +#if defined(PYOPENCL_GL_SHARING_VERSION) && (PYOPENCL_GL_SHARING_VERSION >= 1) inline py::object get_gl_context_info_khr( py::object py_properties,