Skip to content
Snippets Groups Projects
Commit 66c2b9e5 authored by Marko Bencun's avatar Marko Bencun
Browse files

started work on GL interop

parent 28eded1c
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,9 @@ current_directory = os.path.dirname(__file__)
_ffi = FFI()
_cl_header = """
/* gl.h */
typedef unsigned int GLuint; /* 4-byte unsigned */
/* cl.h */
/* scalar types */
typedef int8_t cl_char;
......
......@@ -204,7 +204,7 @@ class MemoryObjectHolder(_Common):
class MemoryObject(MemoryObjectHolder):
pass
class Buffer(MemoryObjectHolder):
class Buffer(MemoryObject):
_id = 'buffer'
@classmethod
......@@ -491,3 +491,14 @@ def _create_instance(cls, ptr):
ins.ptr = ptr
return ins
# gl interop
def have_gl():
return bool(_lib.have_gl())
class GLBuffer(MemoryObject):
_id = 'gl_buffer'
def __init__(self, context, flags, bufobj):
ptr_buffer = _ffi.new('void **')
_handle_error(_lib._create_gl_buffer(ptr_buffer, context.ptr, flags, bufobj))
self.ptr = ptr_buffer[0]
all:
#g++ -c -Wall -DHAVE_GL=1 -DPYOPENCL_PRETEND_CL_VERSION=4112 -fpic wrap_cl.cpp wrap_constants.cpp bitlog.cpp
g++ -c -Wall -DPYOPENCL_PRETEND_CL_VERSION=4112 -fpic wrap_cl.cpp wrap_constants.cpp bitlog.cpp
g++ -c -Wall -DHAVE_GL=1 -DPYOPENCL_PRETEND_CL_VERSION=4112 -fpic wrap_cl.cpp wrap_constants.cpp bitlog.cpp
#g++ -c -Wall -DPYOPENCL_PRETEND_CL_VERSION=4112 -fpic wrap_cl.cpp wrap_constants.cpp bitlog.cpp
g++ -shared -o libwrapcl.so wrap_cl.o wrap_constants.o bitlog.o
cp libwrapcl.so ../../pyopencl/
cp wrap_cl_core.h ../../pyopencl/wrap_cl_core.h
This diff is collapsed.
......@@ -16,7 +16,8 @@ typedef enum {
CLASS_BUFFER,
CLASS_PROGRAM,
CLASS_EVENT,
CLASS_COMMAND_QUEUE
CLASS_COMMAND_QUEUE,
CLASS_GL_BUFFER
} class_t;
......@@ -63,3 +64,7 @@ void _free2(void**, uint32_t size);
unsigned bitlog2(unsigned long v);
/* gl interop */
int have_gl();
error *_create_gl_buffer(void **ptr_buffer, void *ptr_context, cl_mem_flags flags, GLuint bufobj);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment