diff --git a/pyopencl/tools.py b/pyopencl/tools.py index 0bdfa292600a6f7fb6f824a293316d585ba8f309..74f29dbf8c8d41d4768796f9d3bf2db617a570c1 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.CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE, cl.get_apple_cgl_share_group())) + (ctx_props.CGL_SHAREGROUP, cl.get_apple_cgl_share_group())) else: raise NotImplementedError("platform '%s' not yet supported" % sys.platform) @@ -280,4 +280,5 @@ def get_gl_sharing_context_properties(): + # vim: foldmethod=marker diff --git a/src/wrapper/wrap_cl.hpp b/src/wrapper/wrap_cl.hpp index 8df73a23c73f2a045140fd440d11c95e9df690c4..cd5a6a9197f5c26a7949bcf85253bd17ec163c21 100644 --- a/src/wrapper/wrap_cl.hpp +++ b/src/wrapper/wrap_cl.hpp @@ -6,11 +6,10 @@ #ifdef __APPLE__ // Mac ------------------------------------------------------------------------ -#include <OpenCL/opencl.h> -#ifdef HAVE_GL - -#define PYOPENCL_GL_SHARING_VERSION 1 +#include <OpenCL/cl.h> +#include <OpenCL/cl_ext.h> +#ifdef HAVE_GL #include <OpenGL/OpenGL.h> #include <OpenCL/cl_gl.h> #include <OpenCL/cl_gl_ext.h> @@ -18,10 +17,6 @@ #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. @@ -659,20 +654,16 @@ namespace pyopencl break; } -#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 +#if defined(cl_khr_gl_sharing) && (cl_khr_gl_sharing >= 1) 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 + case 0: break; @@ -723,7 +714,7 @@ namespace pyopencl props.push_back( reinterpret_cast<cl_context_properties>(value().data())); } -#if defined(PYOPENCL_GL_SHARING_VERSION) && (PYOPENCL_GL_SHARING_VERSION >= 1) +#if defined(cl_khr_gl_sharing) && (cl_khr_gl_sharing >= 1) #if defined(_WIN32) else if (prop == CL_WGL_HDC_KHR) { @@ -736,9 +727,6 @@ 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"); @@ -2970,7 +2958,7 @@ namespace pyopencl -#if defined(PYOPENCL_GL_SHARING_VERSION) && (PYOPENCL_GL_SHARING_VERSION >= 1) +#if defined(cl_khr_gl_sharing) && (cl_khr_gl_sharing >= 1) inline py::object get_gl_context_info_khr( py::object py_properties,