From 9c38a4177ff603f73849b6c4f1384679cf303f03 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 23 Aug 2015 19:19:35 -0500 Subject: [PATCH] (Not just OS X) GL interop fixes from Gregor Thalhammer --- pyopencl/__init__.py | 15 ++++++++++++++- pyopencl/cffi_cl.py | 5 ++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index 156a4de1..6b678b37 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -149,7 +149,6 @@ from pyopencl.cffi_cl import ( # noqa _GLObject, GLBuffer, GLRenderBuffer, - _create_gl_enqueue, ImageFormat, get_supported_image_formats, @@ -160,6 +159,20 @@ from pyopencl.cffi_cl import ( # noqa GLTexture, ) +if _cl.have_gl(): + try: + from pyopencl.cffi_cl import get_apple_cgl_share_group # noqa + except ImportError: + pass + + try: + from pyopencl.cffi_cl import ( # noqa + enqueue_acquire_gl_objects, + enqueue_release_gl_objects, + ) + except ImportError: + pass + import inspect as _inspect diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index dbbe762a..f2c92063 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -1598,11 +1598,10 @@ class GLBuffer(MemoryObject, _GLObject): _id = 'gl_buffer' def __init__(self, context, flags, bufobj): - MemoryObject.__init__(self, bufobj) - c_buf, bufsize, retained = self._handle_buf_flags(flags) + MemoryObject.__init__(self) ptr = _ffi.new('clobj_t*') _handle_error(_lib.create_from_gl_buffer( - ptr, context.ptr, flags, c_buf)) + ptr, context.ptr, flags, bufobj)) self.ptr = ptr[0] -- GitLab