summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build.xml127
-rw-r--r--nbproject/project.properties2
-rw-r--r--resources/cl-buffer-if.cfg13
-rw-r--r--resources/cl-common.cfg4
-rw-r--r--resources/cl-context-if.cfg23
-rw-r--r--resources/cl-device-if.cfg12
-rw-r--r--resources/cl-event-if.cfg17
-rw-r--r--resources/cl-if.cfg60
-rw-r--r--resources/cl-image-if.cfg16
-rw-r--r--resources/cl-impl.cfg6
-rw-r--r--resources/cl-kernel-if.cfg12
-rw-r--r--resources/cl-mem-if.cfg18
-rw-r--r--resources/cl-platform-if.cfg12
-rw-r--r--resources/cl-program-if.cfg18
-rw-r--r--resources/cl-queue-if.cfg12
-rw-r--r--resources/cl-sampler-if.cfg12
-rw-r--r--resources/clImplCustomCode.c20
-rw-r--r--resources/clgl-if.cfg20
-rw-r--r--resources/includes/CL_orig/cl_ext.h40
-rw-r--r--resources/includes/CL_orig/cl_gl_ext.h4
-rw-r--r--resources/includes/CL_orig/cl_platform.h88
-rw-r--r--src/com/jogamp/opencl/CLBuffer.java20
-rw-r--r--src/com/jogamp/opencl/CLCommandQueue.java43
-rw-r--r--src/com/jogamp/opencl/CLContext.java55
-rw-r--r--src/com/jogamp/opencl/CLDevice.java10
-rw-r--r--src/com/jogamp/opencl/CLEvent.java18
-rw-r--r--src/com/jogamp/opencl/CLEventList.java45
-rw-r--r--src/com/jogamp/opencl/CLException.java2
-rw-r--r--src/com/jogamp/opencl/CLImage.java15
-rw-r--r--src/com/jogamp/opencl/CLImage2d.java3
-rw-r--r--src/com/jogamp/opencl/CLImage3d.java5
-rw-r--r--src/com/jogamp/opencl/CLImageFormat.java4
-rw-r--r--src/com/jogamp/opencl/CLKernel.java66
-rw-r--r--src/com/jogamp/opencl/CLMemory.java62
-rw-r--r--src/com/jogamp/opencl/CLObject.java22
-rw-r--r--src/com/jogamp/opencl/CLObjectResource.java51
-rw-r--r--src/com/jogamp/opencl/CLPlatform.java70
-rw-r--r--src/com/jogamp/opencl/CLProgram.java53
-rw-r--r--src/com/jogamp/opencl/CLResource.java4
-rw-r--r--src/com/jogamp/opencl/CLSampler.java17
-rw-r--r--src/com/jogamp/opencl/CLUserEvent.java9
-rw-r--r--src/com/jogamp/opencl/gl/CLGLBuffer.java8
-rw-r--r--src/com/jogamp/opencl/gl/CLGLContext.java11
-rw-r--r--src/com/jogamp/opencl/gl/CLGLImage2d.java10
-rw-r--r--src/com/jogamp/opencl/gl/CLGLTexture2d.java13
-rw-r--r--src/com/jogamp/opencl/gl/CLGLTexture3d.java13
-rw-r--r--src/com/jogamp/opencl/gl/package.html7
-rw-r--r--src/com/jogamp/opencl/impl/CLTLAccessorFactory.java9
-rw-r--r--src/com/jogamp/opencl/llb/gl/package.html7
-rw-r--r--src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java (renamed from src/com/jogamp/opencl/impl/BuildProgramCallback.java)8
-rw-r--r--src/com/jogamp/opencl/llb/impl/CLEventCallback.java (renamed from src/com/jogamp/opencl/impl/CLEventCallback.java)2
-rw-r--r--src/com/jogamp/opencl/llb/impl/CLImpl.java (renamed from src/com/jogamp/opencl/impl/CLImpl.java)35
-rw-r--r--src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java (renamed from src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java)2
-rw-r--r--src/com/jogamp/opencl/llb/package.html7
-rw-r--r--src/com/jogamp/opencl/package.html7
-rw-r--r--src/com/jogamp/opencl/spi/CLAccessorFactory.java5
-rw-r--r--src/com/jogamp/opencl/spi/package.html7
-rw-r--r--src/com/jogamp/opencl/util/CLBuildListener.java4
-rw-r--r--src/com/jogamp/opencl/util/CLDeviceFilters.java8
-rw-r--r--src/com/jogamp/opencl/util/CLInfo.java2
-rw-r--r--src/com/jogamp/opencl/util/CLMultiContext.java21
-rw-r--r--src/com/jogamp/opencl/util/CLUtil.java2
-rw-r--r--src/com/jogamp/opencl/util/JOCLVersion.java6
-rw-r--r--src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java11
-rw-r--r--src/com/jogamp/opencl/util/concurrent/CLQueueContext.java6
-rw-r--r--src/com/jogamp/opencl/util/concurrent/package.html7
-rw-r--r--src/com/jogamp/opencl/util/package.html7
-rw-r--r--src/overview.html6
-rw-r--r--test/com/jogamp/opencl/CLCommandQueueTest.java1
-rw-r--r--test/com/jogamp/opencl/CLProgramTest.java9
-rw-r--r--test/com/jogamp/opencl/HighLevelBindingTest.java1
-rw-r--r--test/com/jogamp/opencl/LowLevelBindingTest.java5
72 files changed, 1014 insertions, 343 deletions
diff --git a/build.xml b/build.xml
index b1a1234f..be9718bd 100644
--- a/build.xml
+++ b/build.xml
@@ -93,7 +93,119 @@
<echo message=" - - - generate JOCL binding files - - - "/>
- <echo message="generate CL interface..."/>
+ <echo message="generate CL interfaces..."/>
+
+ <echo message="context..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-context-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="program..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-program-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="kernel..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-kernel-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="queue..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-queue-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="device..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-device-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="memobj..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-mem-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="image..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-image-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="buffer..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-buffer-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="sampler..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-sampler-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="event..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-event-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="platform..."/>
+ <gluegen src="resources/opencl.h"
+ config="resources/cl-platform-if.cfg"
+ includeRefid="jocl.include.path"
+ emitter="com.jogamp.gluegen.JavaEmitter"
+ dumpCPP="false"
+ debug="false">
+ <classpath refid="gluegen.classpath" />
+ </gluegen>
+
+ <echo message="CL..."/>
<gluegen src="resources/opencl.h"
config="resources/cl-if.cfg"
includeRefid="jocl.include.path"
@@ -103,7 +215,7 @@
<classpath refid="gluegen.classpath" />
</gluegen>
- <echo message="generate CLGLI interface..."/>
+ <echo message="CLGL..."/>
<gluegen src="resources/opencl.h"
config="resources/clgl-if.cfg"
includeRefid="jocl.include.path"
@@ -112,7 +224,7 @@
<classpath refid="gluegen.classpath" />
</gluegen>
- <echo message="generate GLImpl..."/>
+ <echo message="GLImpl..."/>
<gluegen src="resources/opencl.h"
config="resources/cl-impl.cfg"
includeRefid="jocl.include.path"
@@ -413,12 +525,18 @@
<fileset dir="${jogl.root}/build/javadoc"/>
</copy>
+ <copy file="${basedir}/src/com/jogamp/opencl/llb/package.html"
+ todir="${basedir}/gensrc/java/com/jogamp/opencl/llb" overwrite="true"/>
+
+ <copy file="${basedir}/src/com/jogamp/opencl/llb/gl/package.html"
+ todir="${basedir}/gensrc/java/com/jogamp/opencl/llb/gl" overwrite="true"/>
+
<javadoc author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}"
docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true"
noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}"
private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}"
use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}"
- windowtitle="${javadoc.windowtitle}">
+ windowtitle="${javadoc.windowtitle}" overview="${basedir}/src/overview.html">
<arg line="${javadoc.additionalparam} -J-Dnativetaglet.mapping=${basedir}/resources/native-taglet.properties"/>
<taglet name="net.highteq.nativetaglet.NativeTaglet" path="${gluegen.root}/${rootrel.build}/gluegen.jar"/>
@@ -443,7 +561,6 @@
<include name="**/*.java"/>
</fileset>
- <excludepackage name="com.jogamp.opencl.impl"/>
</javadoc>
</target>
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 7de4c49a..0214d3dd 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -10,7 +10,7 @@ javac.processorpath=\
${javac.classpath}
application.title=JOCL
application.vendor=Michael Bien
-build.classes.excludes=**/*.java,**/*.jtemplate,**/*.form,**/*.c
+build.classes.excludes=**/*.java,**/*.jtemplate,**/*.form,**/*.c,**/*.html
# This directory is removed when the project is cleaned:
build.dir=${rootrel.build}
build.classes.dir=${build.dir}/classes
diff --git a/resources/cl-buffer-if.cfg b/resources/cl-buffer-if.cfg
new file mode 100644
index 00000000..22306727
--- /dev/null
+++ b/resources/cl-buffer-if.cfg
@@ -0,0 +1,13 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+ClassJavadoc CLBufferBinding /**
+ClassJavadoc CLBufferBinding * Java bindings to OpenCL buffers.
+ClassJavadoc CLBufferBinding * @author Michael Bien
+ClassJavadoc CLBufferBinding */
+JavaClass CLBufferBinding
+
+Extends CLBufferBinding CLMemObjBinding
+
+IgnoreNot .*CreateBuffer.*|.*CreateSubBuffer.*
diff --git a/resources/cl-common.cfg b/resources/cl-common.cfg
index baac28f8..36c5d66c 100644
--- a/resources/cl-common.cfg
+++ b/resources/cl-common.cfg
@@ -1,7 +1,7 @@
JavaOutputDir gensrc/java
NativeOutputDir gensrc/native
-Package com.jogamp.opencl
+Package com.jogamp.opencl.llb
#map pointers to long as internal representation
Opaque long cl_context
@@ -98,7 +98,7 @@ NioDirectOnly clGetGLContextInfoKHR
#common rename emitted struct accessors
#struct cl_image_format
RenameJavaType cl_image_format CLImageFormatImpl
-StructPackage cl_image_format com.jogamp.opencl.impl
+StructPackage cl_image_format com.jogamp.opencl.llb.impl
#struct fields ([set|get]+FieldName())
RenameJavaMethod image_channel_order imageChannelOrder
diff --git a/resources/cl-context-if.cfg b/resources/cl-context-if.cfg
new file mode 100644
index 00000000..c1609a79
--- /dev/null
+++ b/resources/cl-context-if.cfg
@@ -0,0 +1,23 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+Import com.jogamp.opencl.llb.impl.CLImageFormatImpl
+Import com.jogamp.opencl.CLErrorHandler
+
+ClassJavadoc CLContextBinding /**
+ClassJavadoc CLContextBinding * Java bindings to OpenCL contexts.
+ClassJavadoc CLContextBinding * @author Michael Bien
+ClassJavadoc CLContextBinding */
+JavaClass CLContextBinding
+
+IgnoreNot clGetSupportedImageFormats.*|.*GetContextInfo.*|.*RetainContext.*|.*ReleaseContext.*|CL_CONTEXT_.*
+
+#custom implementations
+CustomJavaCode CLContextBinding
+CustomJavaCode CLContextBinding /** Interface to C language function: <br> <code> cl_context {@native clCreateContext}(intptr_t * , uint32_t, cl_device_id * , void (*pfn_notify)(const char *, const void *, size_t, void *), void *, int32_t * ); </code> */
+CustomJavaCode CLContextBinding public long clCreateContext(PointerBuffer properties, PointerBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret);
+
+CustomJavaCode CLContextBinding
+CustomJavaCode CLContextBinding /** Interface to C language function: <br> <code> cl_context {@native clCreateContextFromType}(cl_context_properties *properties, cl_device_type device_type, void (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data), void *user_data, cl_int *errcode_ret) ; </code> */
+CustomJavaCode CLContextBinding public long clCreateContextFromType(PointerBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret);
diff --git a/resources/cl-device-if.cfg b/resources/cl-device-if.cfg
new file mode 100644
index 00000000..054cbdb8
--- /dev/null
+++ b/resources/cl-device-if.cfg
@@ -0,0 +1,12 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+ClassJavadoc CLDeviceBinding /**
+ClassJavadoc CLDeviceBinding * Java bindings to OpenCL devices.
+ClassJavadoc CLDeviceBinding * @author Michael Bien
+ClassJavadoc CLDeviceBinding */
+JavaClass CLDeviceBinding
+
+IgnoreNot .*CreateSubDevice.*|.*GetDeviceInfo.*|.*RetainDevice.*|.*ReleaseDevice.*|CL_DEVICE_.*|CL_FP_.*|CL_GLOBAL|CL_LOCAL|CL_READ_.*_CACHE
+
diff --git a/resources/cl-event-if.cfg b/resources/cl-event-if.cfg
new file mode 100644
index 00000000..73a9c772
--- /dev/null
+++ b/resources/cl-event-if.cfg
@@ -0,0 +1,17 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+import com.jogamp.opencl.llb.impl.CLEventCallback
+
+ClassJavadoc CLEventBinding /**
+ClassJavadoc CLEventBinding * Java bindings to OpenCL events.
+ClassJavadoc CLEventBinding * @author Michael Bien
+ClassJavadoc CLEventBinding */
+JavaClass CLEventBinding
+
+IgnoreNot .*CreateUserEvent.*|.*GetEventInfo.*|.*GetEventProfilingInfo.*|.*SetUserEventStatus.*|clWaitForEvents.*|.*RetainEvent.*|.*ReleaseEvent.*|CL_EVENT_.*
+
+CustomJavaCode CLEventBinding
+CustomJavaCode CLEventBinding /** Interface to C language function: <br> <code> int32_t {@native clSetEventCallback}(cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK *pfn_event_notify) (cl_event event, cl_int event_command_exec_status, void *user_data), void *user_data); </code> */
+CustomJavaCode CLEventBinding public int clSetEventCallback(long event, int type, CLEventCallback cb); \ No newline at end of file
diff --git a/resources/cl-if.cfg b/resources/cl-if.cfg
index f65a417b..94c9677e 100644
--- a/resources/cl-if.cfg
+++ b/resources/cl-if.cfg
@@ -2,49 +2,41 @@ Include cl-common.cfg
Style InterfaceOnly
-#imports for all generated java files
-Import java.nio.IntBuffer
-Import java.nio.LongBuffer
-Import com.jogamp.opencl.impl.CLImageFormatImpl
-import com.jogamp.opencl.impl.BuildProgramCallback
-import com.jogamp.opencl.impl.CLEventCallback
-import com.jogamp.opencl.impl.CLMemObjectDestructorCallback
-
ClassJavadoc CL /**
ClassJavadoc CL * Java bindings to OpenCL, the Open Computing Language.
ClassJavadoc CL * @author Michael Bien
ClassJavadoc CL */
JavaClass CL
-#ignore cl-gl interoperability funcions. Interface 'CL' is pure OpenCL.
-Ignore CL_GL_.*|cl.*GL.*
+Extends CL CLContextBinding
+Extends CL CLProgramBinding
+Extends CL CLKernelBinding
+Extends CL CLCommandQueueBinding
+Extends CL CLDeviceBinding
+Extends CL CLImageBinding
+Extends CL CLBufferBinding
+Extends CL CLSamplerBinding
+Extends CL CLEventBinding
+Extends CL CLPlatformBinding
+
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLContextBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLProgramBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLKernelBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLCommandQueueBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLDeviceBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLMemObjBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLImageBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLBufferBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLSamplerBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLEventBinding.java
+ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLPlatformBinding.java
+
+#ignore cl-gl interoperability functions. Interface 'CL' is pure OpenCL.
+Ignore CL_GL_.*|cl.*GL.*|.*_GL_.*
-#custom implementations
Ignore clCreateContext
-CustomJavaCode CL
-CustomJavaCode CL /** Interface to C language function: <br> <code> cl_context {@native clCreateContext}(intptr_t * , uint32_t, cl_device_id * , void (*pfn_notify)(const char *, const void *, size_t, void *), void *, int32_t * ); </code> */
-CustomJavaCode CL public long clCreateContext(PointerBuffer properties, PointerBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret);
-
Ignore clCreateContextFromType
-CustomJavaCode CL
-CustomJavaCode CL /** Interface to C language function: <br> <code> cl_context {@native clCreateContextFromType}(cl_context_properties *properties, cl_device_type device_type, void (*pfn_notify)(const char *errinfo, const void *private_info, size_t cb, void *user_data), void *user_data, cl_int *errcode_ret) ; </code> */
-CustomJavaCode CL public long clCreateContextFromType(PointerBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret);
-
Ignore clBuildProgram
-CustomJavaCode CL
-CustomJavaCode CL /** Interface to C language function: <br> <code> int32_t {@native clBuildProgram}(cl_program, uint32_t, cl_device_id * , const char * , void (*pfn_notify)(cl_program, void *user_data), void * ); </code> */
-CustomJavaCode CL public int clBuildProgram(long program, int deviceCount, PointerBuffer devices, String options, BuildProgramCallback cb);
-
+Ignore clEnqueueNativeKernel
Ignore clSetEventCallback
-CustomJavaCode CL
-CustomJavaCode CL /** Interface to C language function: <br> <code> int32_t {@native clSetEventCallback}(cl_event event, cl_int command_exec_callback_type, void (CL_CALLBACK *pfn_event_notify) (cl_event event, cl_int event_command_exec_status, void *user_data), void *user_data); </code> */
-CustomJavaCode CL public int clSetEventCallback(long event, int type, CLEventCallback cb);
-
Ignore clSetMemObjectDestructorCallback
-CustomJavaCode CL
-CustomJavaCode CL /** Interface to C language function: <br> <code> int32_t {@native clSetMemObjectDestructorCallback}(cl_mem memobj, void (CL_CALLBACK *pfn_notify) (cl_mem memobj, void *user_data), void *user_data); </code> */
-CustomJavaCode CL public int clSetMemObjectDestructorCallback(long memObjID, CLMemObjectDestructorCallback cb);
-
-Ignore clEnqueueNativeKernel
-#TODO..
-
diff --git a/resources/cl-image-if.cfg b/resources/cl-image-if.cfg
new file mode 100644
index 00000000..7d62834b
--- /dev/null
+++ b/resources/cl-image-if.cfg
@@ -0,0 +1,16 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+Import com.jogamp.opencl.llb.impl.CLImageFormatImpl
+
+ClassJavadoc CLImageBinding /**
+ClassJavadoc CLImageBinding * Java bindings to OpenCL images.
+ClassJavadoc CLImageBinding * @author Michael Bien
+ClassJavadoc CLImageBinding */
+JavaClass CLImageBinding
+
+Extends CLImageBinding CLMemObjBinding
+
+IgnoreNot .*CreateImage.*|.*GetImageInfo.*|CL_IMAGE_.*|CL_R|CL_Rx|CL_A|CL_RG|CL_RGx|CL_RA|CL_RGB|CL_RGBx|CL_RGBA|CL_ARGB|CL_BGRA|CL_INTENSITY|CL_LUMINANCE|CL_SNORM_INT8|CL_SNORM_INT16|CL_UNORM_INT8|CL_UNORM_INT16|CL_UNORM_SHORT_565|CL_UNORM_SHORT_555|CL_UNORM_INT_101010|CL_SIGNED_INT8|CL_SIGNED_INT16|CL_SIGNED_INT32|CL_UNSIGNED_INT8|CL_UNSIGNED_INT16|CL_UNSIGNED_INT32|CL_HALF_FLOAT|CL_FLOAT
+
diff --git a/resources/cl-impl.cfg b/resources/cl-impl.cfg
index 4a34683e..1f9240a2 100644
--- a/resources/cl-impl.cfg
+++ b/resources/cl-impl.cfg
@@ -3,8 +3,8 @@ Include cl-common.cfg
Style ImplOnly
#imports for all generated java files
-Import com.jogamp.opencl.*
-Import com.jogamp.opencl.gl.CLGLI
+Import com.jogamp.opencl.llb.*
+Import com.jogamp.opencl.llb.gl.CLGL
ClassJavadoc CLAbstractImpl /**
ClassJavadoc CLAbstractImpl * Java bindings to OpenCL, the Open Computing Language (generated).
@@ -13,7 +13,7 @@ ClassJavadoc CLAbstractImpl */
ImplJavaClass CLAbstractImpl
AccessControl CLAbstractImpl PUBLIC_ABSTRACT
-Implements CLAbstractImpl CLGLI
+Implements CLAbstractImpl CLGL
EmitProcAddressTable true
ProcAddressTableClassName CLProcAddressTable
diff --git a/resources/cl-kernel-if.cfg b/resources/cl-kernel-if.cfg
new file mode 100644
index 00000000..732ab858
--- /dev/null
+++ b/resources/cl-kernel-if.cfg
@@ -0,0 +1,12 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+ClassJavadoc CLKernelBinding /**
+ClassJavadoc CLKernelBinding * Java bindings to OpenCL kernels.
+ClassJavadoc CLKernelBinding * @author Michael Bien
+ClassJavadoc CLKernelBinding */
+JavaClass CLKernelBinding
+
+IgnoreNot .*CreateKernel.*|.*GetKernel.*Info.*|.*SetKernel.*|.*RetainKernel.*|.*ReleaseKernel.*|CL_KERNEL_.*
+
diff --git a/resources/cl-mem-if.cfg b/resources/cl-mem-if.cfg
new file mode 100644
index 00000000..aae750e2
--- /dev/null
+++ b/resources/cl-mem-if.cfg
@@ -0,0 +1,18 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+import com.jogamp.opencl.llb.impl.CLMemObjectDestructorCallback
+
+ClassJavadoc CLMemObjBinding /**
+ClassJavadoc CLMemObjBinding * Java bindings to OpenCL memory objects.
+ClassJavadoc CLMemObjBinding * @author Michael Bien
+ClassJavadoc CLMemObjBinding */
+JavaClass CLMemObjBinding
+
+IgnoreNot .*GetMemObjectInfo.*|.*RetainMemObject.*|.*ReleaseMemObject.*|CL_MEM_.*|CL_MAP_.*
+
+CustomJavaCode CLMemObjBinding
+CustomJavaCode CLMemObjBinding /** Interface to C language function: <br> <code> int32_t {@native clSetMemObjectDestructorCallback}(cl_mem memobj, void (CL_CALLBACK *pfn_notify) (cl_mem memobj, void *user_data), void *user_data); </code> */
+CustomJavaCode CLMemObjBinding public int clSetMemObjectDestructorCallback(long memObjID, CLMemObjectDestructorCallback cb);
+
diff --git a/resources/cl-platform-if.cfg b/resources/cl-platform-if.cfg
new file mode 100644
index 00000000..e66f5bda
--- /dev/null
+++ b/resources/cl-platform-if.cfg
@@ -0,0 +1,12 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+ClassJavadoc CLPlatformBinding /**
+ClassJavadoc CLPlatformBinding * Java bindings to OpenCL platforms.
+ClassJavadoc CLPlatformBinding * @author Michael Bien
+ClassJavadoc CLPlatformBinding */
+JavaClass CLPlatformBinding
+
+IgnoreNot .*GetPlatformInfo.*|.*GetDeviceIDs.*|.*GetPlatformIDs.*|CL_PLATFORM_.*
+
diff --git a/resources/cl-program-if.cfg b/resources/cl-program-if.cfg
new file mode 100644
index 00000000..251ade76
--- /dev/null
+++ b/resources/cl-program-if.cfg
@@ -0,0 +1,18 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+Import com.jogamp.opencl.llb.impl.BuildProgramCallback
+
+ClassJavadoc CLProgramBinding /**
+ClassJavadoc CLProgramBinding * Java bindings to OpenCL programs.
+ClassJavadoc CLProgramBinding * @author Michael Bien
+ClassJavadoc CLProgramBinding */
+JavaClass CLProgramBinding
+
+IgnoreNot .*CreateProgramWith.*|.*Program.*Info.*|.*RetainProgram.*|.*ReleaseProgram.*|CL_PROGRAM_.*|CL_BUILD_.*
+
+#custom implementations
+CustomJavaCode CLProgramBinding
+CustomJavaCode CLProgramBinding /** Interface to C language function: <br> <code> int32_t {@native clBuildProgram}(cl_program, uint32_t, cl_device_id * , const char * , void (*pfn_notify)(cl_program, void *user_data), void * ); </code> */
+CustomJavaCode CLProgramBinding public int clBuildProgram(long program, int deviceCount, PointerBuffer devices, String options, BuildProgramCallback cb);
diff --git a/resources/cl-queue-if.cfg b/resources/cl-queue-if.cfg
new file mode 100644
index 00000000..a8f6584d
--- /dev/null
+++ b/resources/cl-queue-if.cfg
@@ -0,0 +1,12 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+ClassJavadoc CLCommandQueueBinding /**
+ClassJavadoc CLCommandQueueBinding * Java bindings to OpenCL command queues.
+ClassJavadoc CLCommandQueueBinding * @author Michael Bien
+ClassJavadoc CLCommandQueueBinding */
+JavaClass CLCommandQueueBinding
+
+IgnoreNot .*CreateCommandQueue.*|.*GetCommandQueueInfo.*|.*EnqueueRead.*|.*EnqueueWrite.*|.*EnqueueCopy.*|.*EnqueueMap.*|.*EnqueueUnmap.*|.*EnqueueBarrier.*|.*EnqueueNDRange.*|.*EnqueueTask.*|.*EnqueueMarker.*|.*EnqueueWait.*|.*EnqueueMigrate.*|.*RetainCommandQueue.*|.*ReleaseCommandQueue.*|clFinish|clFlush|CL_QUEUE_.*|CL_COMMAND_.*|CL_PROFILING_COMMAND_.*
+
diff --git a/resources/cl-sampler-if.cfg b/resources/cl-sampler-if.cfg
new file mode 100644
index 00000000..f6382a59
--- /dev/null
+++ b/resources/cl-sampler-if.cfg
@@ -0,0 +1,12 @@
+Include cl-common.cfg
+
+Style InterfaceOnly
+
+ClassJavadoc CLSamplerBinding /**
+ClassJavadoc CLSamplerBinding * Java bindings to OpenCL sampler objects.
+ClassJavadoc CLSamplerBinding * @author Michael Bien
+ClassJavadoc CLSamplerBinding */
+JavaClass CLSamplerBinding
+
+IgnoreNot .*CreateSampler.*|.*GetSamplerInfo.*|.*RetainSampler.*|.*ReleaseSampler.*|CL_SAMPLER_.*|CL_ADDRESS_.*|CL_FILTER_.*
+
diff --git a/resources/clImplCustomCode.c b/resources/clImplCustomCode.c
index bdce55a5..4a43ae3b 100644
--- a/resources/clImplCustomCode.c
+++ b/resources/clImplCustomCode.c
@@ -26,10 +26,10 @@ JNI_OnLoad(JavaVM * _jvm, void *reserved) {
}
// throws ClassNotFoundException (or other reflection stuff)
- jclass buildCBClassID = (*env)->FindClass(env, "com/jogamp/opencl/impl/BuildProgramCallback");
+ jclass buildCBClassID = (*env)->FindClass(env, "com/jogamp/opencl/llb/impl/BuildProgramCallback");
jclass errorHandlerClassID = (*env)->FindClass(env, "com/jogamp/opencl/CLErrorHandler");
- jclass eventCBClassID = (*env)->FindClass(env, "com/jogamp/opencl/impl/CLEventCallback");
- jclass memObjCBClassID = (*env)->FindClass(env, "com/jogamp/opencl/impl/CLMemObjectDestructorCallback");
+ jclass eventCBClassID = (*env)->FindClass(env, "com/jogamp/opencl/llb/impl/CLEventCallback");
+ jclass memObjCBClassID = (*env)->FindClass(env, "com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback");
// throws even more reflection Exceptions
// IDs are unique and do not change
@@ -123,7 +123,7 @@ CL_CALLBACK void memObjDestructorCallback(cl_mem mem, void * object) {
* cl_int * errcode_ret);
*/
JNIEXPORT jlong JNICALL
-Java_com_jogamp_opencl_impl_CLImpl_clCreateContextFromType0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl_clCreateContextFromType0(JNIEnv *env, jobject _unused,
jobject props, jint props_byte_offset, jlong device_type, jobject cb, jobject global, jobject errcode, jint errcode_byte_offset, jlong procAddress) {
cl_context_properties* _props_ptr = NULL;
@@ -176,7 +176,7 @@ Java_com_jogamp_opencl_impl_CLImpl_clCreateContextFromType0(JNIEnv *env, jobject
* cl_int * errcode_ret ) CL_API_SUFFIX__VERSION_1_0;
*/
JNIEXPORT jlong JNICALL
-Java_com_jogamp_opencl_impl_CLImpl_clCreateContext0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl_clCreateContext0(JNIEnv *env, jobject _unused,
jobject props, jint props_byte_offset, jint numDevices, jobject deviceList, jint device_type_offset, jobject cb, jobject global, jobject errcode, jint errcode_byte_offset, jlong procAddress) {
cl_context_properties* _props_ptr = NULL;
@@ -227,7 +227,7 @@ Java_com_jogamp_opencl_impl_CLImpl_clCreateContext0(JNIEnv *env, jobject _unused
* C function: int32_t clReleaseContextImpl(cl_context context);
*/
JNIEXPORT jint JNICALL
-Java_com_jogamp_opencl_impl_CLImpl_clReleaseContextImpl(JNIEnv *env, jobject _unused, jlong context, jlong global, jlong procAddress) {
+Java_com_jogamp_opencl_llb_impl_CLImpl_clReleaseContextImpl(JNIEnv *env, jobject _unused, jlong context, jlong global, jlong procAddress) {
int32_t _res;
typedef int32_t (*function)(cl_context);
@@ -253,7 +253,7 @@ Java_com_jogamp_opencl_impl_CLImpl_clReleaseContextImpl(JNIEnv *env, jobject _un
* void * user_data ) CL_API_SUFFIX__VERSION_1_0;
*/
JNIEXPORT jint JNICALL
-Java_com_jogamp_opencl_impl_CLImpl_clBuildProgram0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl_clBuildProgram0(JNIEnv *env, jobject _unused,
jlong program, jint deviceCount, jobject deviceList, jint device_type_offset, jstring options, jobject cb, jlong procAddress) {
const char* _strchars_options = NULL;
@@ -303,7 +303,7 @@ Java_com_jogamp_opencl_impl_CLImpl_clBuildProgram0(JNIEnv *env, jobject _unused,
* C function: void * clEnqueueMapImage(cl_command_queue command_queue, cl_mem image, uint32_t blocking_map, uint64_t map_flags, const size_t * , const size_t * , size_t * image_row_pitch, size_t * image_slice_pitch, uint32_t num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, int32_t * errcode_ret);
*/
JNIEXPORT jobject JNICALL
-Java_com_jogamp_opencl_impl_CLImpl_clEnqueueMapImage0__JJIJLjava_lang_Object_2ILjava_lang_Object_2ILjava_lang_Object_2ILjava_lang_Object_2IILjava_lang_Object_2ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl_clEnqueueMapImage0__JJIJLjava_lang_Object_2ILjava_lang_Object_2ILjava_lang_Object_2ILjava_lang_Object_2IILjava_lang_Object_2ILjava_lang_Object_2ILjava_lang_Object_2I(JNIEnv *env, jobject _unused,
jlong command_queue, jlong image, jint blocking_map, jlong map_flags,
jobject origin, jint origin_byte_offset, jobject range, jint range_byte_offset,
jobject image_row_pitch, jint image_row_pitch_byte_offset, jobject image_slice_pitch,
@@ -380,7 +380,7 @@ Java_com_jogamp_opencl_impl_CLImpl_clEnqueueMapImage0__JJIJLjava_lang_Object_2IL
}
JNIEXPORT jint JNICALL
-Java_com_jogamp_opencl_impl_CLImpl_clSetEventCallback0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl_clSetEventCallback0(JNIEnv *env, jobject _unused,
jlong event, jint trigger, jobject listener, jlong procAddress) {
cl_event _event = event;
@@ -396,7 +396,7 @@ Java_com_jogamp_opencl_impl_CLImpl_clSetEventCallback0(JNIEnv *env, jobject _unu
}
JNIEXPORT jint JNICALL
-Java_com_jogamp_opencl_impl_CLImpl_clSetMemObjectDestructorCallback0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl_clSetMemObjectDestructorCallback0(JNIEnv *env, jobject _unused,
jlong mem, jobject listener, jlong procAddress) {
cl_mem _mem = mem;
diff --git a/resources/clgl-if.cfg b/resources/clgl-if.cfg
index 8e3e5292..2f193c73 100644
--- a/resources/clgl-if.cfg
+++ b/resources/clgl-if.cfg
@@ -1,23 +1,23 @@
Include cl-common.cfg
#overwrite package
-Package com.jogamp.opencl.gl
+Package com.jogamp.opencl.llb.gl
-import com.jogamp.opencl.CL
+import com.jogamp.opencl.llb.CL
Style InterfaceOnly
-ClassJavadoc CLGLI /**
-ClassJavadoc CLGLI * Java bindings to OpenCL, the Open Computing Language.
-ClassJavadoc CLGLI * OpenGL - OpenCL interoperability.
-ClassJavadoc CLGLI * @author Michael Bien
-ClassJavadoc CLGLI */
-JavaClass CLGLI
+ClassJavadoc CLGL /**
+ClassJavadoc CLGL * Java bindings to OpenCL, the Open Computing Language.
+ClassJavadoc CLGL * OpenGL - OpenCL interoperability.
+ClassJavadoc CLGL * @author Michael Bien
+ClassJavadoc CLGL */
+JavaClass CLGL
-Extends CLGLI CL
+Extends CLGL CL
#only include token starting with CL_GL_ and methods containing GL
-IgnoreNot CL_GL_.*|cl.*GL.*
+IgnoreNot CL_GL_.*|cl.*GL.*|.*_GL_.*
#append to generated c files
#CustomCCode #include <inttypes.h>
diff --git a/resources/includes/CL_orig/cl_ext.h b/resources/includes/CL_orig/cl_ext.h
index 4e92c7e6..7310fd2b 100644
--- a/resources/includes/CL_orig/cl_ext.h
+++ b/resources/includes/CL_orig/cl_ext.h
@@ -21,7 +21,7 @@
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
******************************************************************************/
-/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
+/* $Revision: 14835 $ on $Date: 2011-05-26 11:32:00 -0700 (Thu, 26 May 2011) $ */
/* cl_ext.h contains OpenCL extensions which don't have external */
/* (OpenGL, D3D) dependencies. */
@@ -200,9 +200,41 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
-
-
-
+
+ /* cl_ext_atomic_counters_32 and cl_ext_atomic_counters_64 extensions
+ * no extension #define since they have no functions
+ */
+ #define CL_DEVICE_MAX_ATOMIC_COUNTERS_EXT 0x4032
+
+ /***********************************
+ * cl_ext_migrate_memobject extension definitions
+ ***********************************/
+ #define cl_ext_migrate_memobject 1
+
+ typedef cl_bitfield cl_mem_migration_flags_ext;
+
+ #define CL_MIGRATE_MEM_OBJECT_HOST_EXT 0x1
+
+ #define CL_COMMAND_MIGRATE_MEM_OBJECT_EXT 0x4040
+
+ extern CL_API_ENTRY cl_int CL_API_CALL
+ clEnqueueMigrateMemObjectEXT( cl_command_queue /* command_queue */,
+ cl_uint /* num_mem_objects */,
+ const cl_mem * /* mem_objects */,
+ cl_mem_migration_flags_ext /* flags */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_1;
+
+ typedef CL_API_ENTRY cl_int
+ (CL_API_CALL *clEnqueueMigrateMemObjectEXT_fn)( cl_command_queue /* command_queue */,
+ cl_uint /* num_mem_objects */,
+ const cl_mem * /* mem_objects */,
+ cl_mem_migration_flags_ext /* flags */,
+ cl_uint /* num_events_in_wait_list */,
+ const cl_event * /* event_wait_list */,
+ cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_1;
+
#endif /* CL_VERSION_1_1 */
#ifdef __cplusplus
diff --git a/resources/includes/CL_orig/cl_gl_ext.h b/resources/includes/CL_orig/cl_gl_ext.h
index 26e47821..fbf8b326 100644
--- a/resources/includes/CL_orig/cl_gl_ext.h
+++ b/resources/includes/CL_orig/cl_gl_ext.h
@@ -21,7 +21,7 @@
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
**********************************************************************************/
-/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
+/* $Revision: 14826 $ on $Date: 2011-05-26 07:40:43 -0700 (Thu, 26 May 2011) $ */
/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
/* OpenGL dependencies. */
@@ -41,7 +41,7 @@ extern "C" {
/*
* For each extension, follow this template
- * /* cl_VEN_extname extension */
+ * cl_VEN_extname extension */
/* #define cl_VEN_extname 1
* ... define new types, if any
* ... define new tokens, if any
diff --git a/resources/includes/CL_orig/cl_platform.h b/resources/includes/CL_orig/cl_platform.h
index 8ef99ff1..c8c6d7f6 100644
--- a/resources/includes/CL_orig/cl_platform.h
+++ b/resources/includes/CL_orig/cl_platform.h
@@ -21,7 +21,7 @@
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
**********************************************************************************/
-/* $Revision: 11803 $ on $Date: 2010-06-25 10:02:12 -0700 (Fri, 25 Jun 2010) $ */
+/* $Revision: 14829 $ on $Date: 2011-05-26 08:22:50 -0700 (Thu, 26 May 2011) $ */
#ifndef __CL_PLATFORM_H
#define __CL_PLATFORM_H
@@ -235,7 +235,7 @@ typedef double cl_double __attribute__((aligned(8)));
#define CL_M_SQRT2_F 1.41421353816986f
#define CL_M_SQRT1_2_F 0.70710676908493f
-#if defined( __GNUC__ )
+#if (defined( __GNUC__ ) || defined( __IBMC__ ))
#define CL_HUGE_VALF __builtin_huge_valf()
#define CL_HUGE_VAL __builtin_huge_val()
#define CL_NAN __builtin_nanf( "" )
@@ -396,7 +396,7 @@ typedef unsigned int cl_GLenum;
#endif
/* Define alignment keys */
-#if defined( __GNUC__ )
+#if (defined( __GNUC__ ) || defined( __IBMC__ ))
#define CL_ALIGNED(_x) __attribute__ ((aligned(_x)))
#elif defined( _WIN32) && (_MSC_VER)
/* Alignment keys neutered on windows because MSVC can't swallow function arguments with alignment requirements */
@@ -410,7 +410,7 @@ typedef unsigned int cl_GLenum;
#endif
/* Indicate whether .xyzw, .s0123 and .hi.lo are supported */
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
/* .xyzw and .s0123...{f|F} are supported */
#define CL_HAS_NAMED_VECTOR_FIELDS 1
/* .hi and .lo are supported */
@@ -423,7 +423,7 @@ typedef unsigned int cl_GLenum;
typedef union
{
cl_char CL_ALIGNED(2) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_char x, y; };
__extension__ struct{ cl_char s0, s1; };
__extension__ struct{ cl_char lo, hi; };
@@ -436,7 +436,7 @@ typedef union
typedef union
{
cl_char CL_ALIGNED(4) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_char x, y, z, w; };
__extension__ struct{ cl_char s0, s1, s2, s3; };
__extension__ struct{ cl_char2 lo, hi; };
@@ -455,7 +455,7 @@ typedef cl_char4 cl_char3;
typedef union
{
cl_char CL_ALIGNED(8) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_char x, y, z, w; };
__extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_char4 lo, hi; };
@@ -474,7 +474,7 @@ typedef union
typedef union
{
cl_char CL_ALIGNED(16) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_char x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_char s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_char8 lo, hi; };
@@ -498,7 +498,7 @@ typedef union
typedef union
{
cl_uchar CL_ALIGNED(2) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_uchar x, y; };
__extension__ struct{ cl_uchar s0, s1; };
__extension__ struct{ cl_uchar lo, hi; };
@@ -511,7 +511,7 @@ typedef union
typedef union
{
cl_uchar CL_ALIGNED(4) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_uchar x, y, z, w; };
__extension__ struct{ cl_uchar s0, s1, s2, s3; };
__extension__ struct{ cl_uchar2 lo, hi; };
@@ -530,7 +530,7 @@ typedef cl_uchar4 cl_uchar3;
typedef union
{
cl_uchar CL_ALIGNED(8) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_uchar x, y, z, w; };
__extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_uchar4 lo, hi; };
@@ -549,7 +549,7 @@ typedef union
typedef union
{
cl_uchar CL_ALIGNED(16) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_uchar x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_uchar s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_uchar8 lo, hi; };
@@ -573,7 +573,7 @@ typedef union
typedef union
{
cl_short CL_ALIGNED(4) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_short x, y; };
__extension__ struct{ cl_short s0, s1; };
__extension__ struct{ cl_short lo, hi; };
@@ -586,7 +586,7 @@ typedef union
typedef union
{
cl_short CL_ALIGNED(8) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_short x, y, z, w; };
__extension__ struct{ cl_short s0, s1, s2, s3; };
__extension__ struct{ cl_short2 lo, hi; };
@@ -605,7 +605,7 @@ typedef cl_short4 cl_short3;
typedef union
{
cl_short CL_ALIGNED(16) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_short x, y, z, w; };
__extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_short4 lo, hi; };
@@ -624,7 +624,7 @@ typedef union
typedef union
{
cl_short CL_ALIGNED(32) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_short x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_short s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_short8 lo, hi; };
@@ -648,7 +648,7 @@ typedef union
typedef union
{
cl_ushort CL_ALIGNED(4) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_ushort x, y; };
__extension__ struct{ cl_ushort s0, s1; };
__extension__ struct{ cl_ushort lo, hi; };
@@ -661,7 +661,7 @@ typedef union
typedef union
{
cl_ushort CL_ALIGNED(8) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_ushort x, y, z, w; };
__extension__ struct{ cl_ushort s0, s1, s2, s3; };
__extension__ struct{ cl_ushort2 lo, hi; };
@@ -680,7 +680,7 @@ typedef cl_ushort4 cl_ushort3;
typedef union
{
cl_ushort CL_ALIGNED(16) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_ushort x, y, z, w; };
__extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_ushort4 lo, hi; };
@@ -699,7 +699,7 @@ typedef union
typedef union
{
cl_ushort CL_ALIGNED(32) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_ushort x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_ushort s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_ushort8 lo, hi; };
@@ -722,7 +722,7 @@ typedef union
typedef union
{
cl_int CL_ALIGNED(8) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_int x, y; };
__extension__ struct{ cl_int s0, s1; };
__extension__ struct{ cl_int lo, hi; };
@@ -735,7 +735,7 @@ typedef union
typedef union
{
cl_int CL_ALIGNED(16) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_int x, y, z, w; };
__extension__ struct{ cl_int s0, s1, s2, s3; };
__extension__ struct{ cl_int2 lo, hi; };
@@ -754,7 +754,7 @@ typedef cl_int4 cl_int3;
typedef union
{
cl_int CL_ALIGNED(32) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_int x, y, z, w; };
__extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_int4 lo, hi; };
@@ -773,7 +773,7 @@ typedef union
typedef union
{
cl_int CL_ALIGNED(64) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_int x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_int s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_int8 lo, hi; };
@@ -797,7 +797,7 @@ typedef union
typedef union
{
cl_uint CL_ALIGNED(8) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_uint x, y; };
__extension__ struct{ cl_uint s0, s1; };
__extension__ struct{ cl_uint lo, hi; };
@@ -810,7 +810,7 @@ typedef union
typedef union
{
cl_uint CL_ALIGNED(16) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_uint x, y, z, w; };
__extension__ struct{ cl_uint s0, s1, s2, s3; };
__extension__ struct{ cl_uint2 lo, hi; };
@@ -829,7 +829,7 @@ typedef cl_uint4 cl_uint3;
typedef union
{
cl_uint CL_ALIGNED(32) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_uint x, y, z, w; };
__extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_uint4 lo, hi; };
@@ -848,7 +848,7 @@ typedef union
typedef union
{
cl_uint CL_ALIGNED(64) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_uint x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_uint s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_uint8 lo, hi; };
@@ -871,7 +871,7 @@ typedef union
typedef union
{
cl_long CL_ALIGNED(16) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_long x, y; };
__extension__ struct{ cl_long s0, s1; };
__extension__ struct{ cl_long lo, hi; };
@@ -884,7 +884,7 @@ typedef union
typedef union
{
cl_long CL_ALIGNED(32) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_long x, y, z, w; };
__extension__ struct{ cl_long s0, s1, s2, s3; };
__extension__ struct{ cl_long2 lo, hi; };
@@ -903,7 +903,7 @@ typedef cl_long4 cl_long3;
typedef union
{
cl_long CL_ALIGNED(64) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_long x, y, z, w; };
__extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_long4 lo, hi; };
@@ -922,7 +922,7 @@ typedef union
typedef union
{
cl_long CL_ALIGNED(128) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_long x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_long s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_long8 lo, hi; };
@@ -946,7 +946,7 @@ typedef union
typedef union
{
cl_ulong CL_ALIGNED(16) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_ulong x, y; };
__extension__ struct{ cl_ulong s0, s1; };
__extension__ struct{ cl_ulong lo, hi; };
@@ -959,7 +959,7 @@ typedef union
typedef union
{
cl_ulong CL_ALIGNED(32) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_ulong x, y, z, w; };
__extension__ struct{ cl_ulong s0, s1, s2, s3; };
__extension__ struct{ cl_ulong2 lo, hi; };
@@ -978,7 +978,7 @@ typedef cl_ulong4 cl_ulong3;
typedef union
{
cl_ulong CL_ALIGNED(64) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_ulong x, y, z, w; };
__extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_ulong4 lo, hi; };
@@ -997,7 +997,7 @@ typedef union
typedef union
{
cl_ulong CL_ALIGNED(128) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_ulong x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_ulong s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_ulong8 lo, hi; };
@@ -1022,7 +1022,7 @@ typedef union
typedef union
{
cl_float CL_ALIGNED(8) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_float x, y; };
__extension__ struct{ cl_float s0, s1; };
__extension__ struct{ cl_float lo, hi; };
@@ -1035,7 +1035,7 @@ typedef union
typedef union
{
cl_float CL_ALIGNED(16) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_float x, y, z, w; };
__extension__ struct{ cl_float s0, s1, s2, s3; };
__extension__ struct{ cl_float2 lo, hi; };
@@ -1054,7 +1054,7 @@ typedef cl_float4 cl_float3;
typedef union
{
cl_float CL_ALIGNED(32) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_float x, y, z, w; };
__extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_float4 lo, hi; };
@@ -1073,7 +1073,7 @@ typedef union
typedef union
{
cl_float CL_ALIGNED(64) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_float x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_float s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_float8 lo, hi; };
@@ -1097,7 +1097,7 @@ typedef union
typedef union
{
cl_double CL_ALIGNED(16) s[2];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_double x, y; };
__extension__ struct{ cl_double s0, s1; };
__extension__ struct{ cl_double lo, hi; };
@@ -1110,7 +1110,7 @@ typedef union
typedef union
{
cl_double CL_ALIGNED(32) s[4];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_double x, y, z, w; };
__extension__ struct{ cl_double s0, s1, s2, s3; };
__extension__ struct{ cl_double2 lo, hi; };
@@ -1129,7 +1129,7 @@ typedef cl_double4 cl_double3;
typedef union
{
cl_double CL_ALIGNED(64) s[8];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_double x, y, z, w; };
__extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7; };
__extension__ struct{ cl_double4 lo, hi; };
@@ -1148,7 +1148,7 @@ typedef union
typedef union
{
cl_double CL_ALIGNED(128) s[16];
-#if defined( __GNUC__) && ! defined( __STRICT_ANSI__ )
+#if (defined( __GNUC__) || defined( __IBMC__ )) && ! defined( __STRICT_ANSI__ )
__extension__ struct{ cl_double x, y, z, w, __spacer4, __spacer5, __spacer6, __spacer7, __spacer8, __spacer9, sa, sb, sc, sd, se, sf; };
__extension__ struct{ cl_double s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, sA, sB, sC, sD, sE, sF; };
__extension__ struct{ cl_double8 lo, hi; };
diff --git a/src/com/jogamp/opencl/CLBuffer.java b/src/com/jogamp/opencl/CLBuffer.java
index 57fba461..99721413 100644
--- a/src/com/jogamp/opencl/CLBuffer.java
+++ b/src/com/jogamp/opencl/CLBuffer.java
@@ -32,6 +32,8 @@ import com.jogamp.common.nio.Buffers;
import java.util.List;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.CLMemory.Mem;
+import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.llb.CLBufferBinding;
import java.nio.Buffer;
import java.util.ArrayList;
import java.util.Collections;
@@ -57,14 +59,13 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> {
@SuppressWarnings("unchecked")
static CLBuffer<?> create(CLContext context, int size, int flags) {
- CL cl = context.cl;
- int[] result = new int[1];
-
if(isHostPointerFlag(flags)) {
throw new IllegalArgumentException("no host pointer defined");
}
- long id = cl.clCreateBuffer(context.ID, flags, size, null, result, 0);
+ CLBufferBinding binding = context.getPlatform().getBufferBinding();
+ int[] result = new int[1];
+ long id = binding.clCreateBuffer(context.ID, flags, size, null, result, 0);
checkForError(result[0], "can not create cl buffer");
return new CLBuffer(context, size, id, flags);
@@ -76,14 +77,14 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> {
throw new IllegalArgumentException("buffer is not direct");
B host_ptr = null;
- CL cl = context.cl;
- int[] result = new int[1];
-
if(isHostPointerFlag(flags)) {
host_ptr = directBuffer;
}
+
+ CLBufferBinding binding = context.getPlatform().getBufferBinding();
+ int[] result = new int[1];
int size = Buffers.sizeOfBufferElem(directBuffer) * directBuffer.capacity();
- long id = cl.clCreateBuffer(context.ID, flags, size, host_ptr, result, 0);
+ long id = binding.clCreateBuffer(context.ID, flags, size, host_ptr, result, 0);
checkForError(result[0], "can not create cl buffer");
return new CLBuffer<B>(context, directBuffer, size, id, flags);
@@ -112,8 +113,9 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> {
info.put(offset).put(size).rewind();
int bitset = Mem.flagsToInt(flags);
+ CLBufferBinding binding = getPlatform().getBufferBinding();
int[] err = new int[1];
- long subID = cl.clCreateSubBuffer(ID, bitset, CL.CL_BUFFER_CREATE_TYPE_REGION, info.getBuffer(), err, 0);
+ long subID = binding.clCreateSubBuffer(ID, bitset, CL.CL_BUFFER_CREATE_TYPE_REGION, info.getBuffer(), err, 0);
checkForError(err[0], "can not create sub buffer");
CLSubBuffer<B> clSubBuffer = new CLSubBuffer<B>(this, offset, size, slice, subID, bitset);
diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java
index 7f3a4292..eedb0bd4 100644
--- a/src/com/jogamp/opencl/CLCommandQueue.java
+++ b/src/com/jogamp/opencl/CLCommandQueue.java
@@ -29,9 +29,10 @@
package com.jogamp.opencl;
import com.jogamp.common.nio.CachedBufferFactory;
-import com.jogamp.opencl.gl.CLGLI;
+import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.gl.CLGLObject;
+import com.jogamp.opencl.llb.CLCommandQueueBinding;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
@@ -41,7 +42,7 @@ import java.util.EnumSet;
import java.util.List;
import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
import static com.jogamp.opencl.util.CLUtil.*;
/**
@@ -57,8 +58,9 @@ import static com.jogamp.opencl.util.CLUtil.*;
* @see CLDevice#createCommandQueue(com.jogamp.opencl.CLCommandQueue.Mode...)
* @author Michael Bien
*/
-public class CLCommandQueue extends CLObject implements CLResource {
+public class CLCommandQueue extends CLObjectResource {
+ private final CLCommandQueueBinding cl;
private final CLDevice device;
private long properties;
@@ -75,6 +77,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
this.device = device;
this.properties = properties;
+ this.cl = context.getPlatform().getCommandQueueBinding();
int pbsize = PointerBuffer.ELEMENT_SIZE;
CachedBufferFactory factory = CachedBufferFactory.create(9*pbsize + 4, true);
@@ -89,7 +92,8 @@ public class CLCommandQueue extends CLObject implements CLResource {
static CLCommandQueue create(CLContext context, CLDevice device, long properties) {
int[] status = new int[1];
- long id = context.cl.clCreateCommandQueue(context.ID, device.ID, properties, status, 0);
+ CLCommandQueueBinding binding = context.getPlatform().getCommandQueueBinding();
+ long id = binding.clCreateCommandQueue(context.ID, device.ID, properties, status, 0);
if(status[0] != CL_SUCCESS) {
throw newException(status[0], "can not create command queue on " + device +" with properties: " + Mode.valuesOf(properties));
@@ -1351,12 +1355,16 @@ public class CLCommandQueue extends CLObject implements CLResource {
*/
public CLCommandQueue putWaitForEvent(CLEventList list, int index, boolean blockingWait) {
- PointerBuffer ids = list.IDs.duplicate().position(index);
- int ret = blockingWait ? cl.clWaitForEvents(1, ids)
- : cl.clEnqueueWaitForEvents(ID, 1, ids);
- if(ret != CL_SUCCESS) {
- throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for event #" + index+ " in "+list);
+ if(blockingWait) {
+ list.waitForEvent(index);
+ } else {
+ PointerBuffer ids = list.getEventBuffer(index);
+ int ret = cl.clEnqueueWaitForEvents(ID, 1, ids);
+ if(ret != CL_SUCCESS) {
+ throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for event #" + index+ " in "+list);
+ }
}
+
return this;
}
@@ -1364,10 +1372,13 @@ public class CLCommandQueue extends CLObject implements CLResource {
* Calls {@native clWaitForEvents} if blockingWait equals true otherwise {@native clEnqueueWaitForEvents}.
*/
public CLCommandQueue putWaitForEvents(CLEventList list, boolean blockingWait) {
- int ret = blockingWait ? cl.clWaitForEvents(list.size, list.IDsView)
- : cl.clEnqueueWaitForEvents(ID, list.size, list.IDsView);
- if(ret != CL_SUCCESS) {
- throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for events " + list);
+ if(blockingWait) {
+ list.waitForEvents();
+ }else{
+ int ret = cl.clEnqueueWaitForEvents(ID, list.size, list.IDsView);
+ if(ret != CL_SUCCESS) {
+ throw newException(ret, "can not "+ (blockingWait?"blocking": "") +" wait for events " + list);
+ }
}
return this;
}
@@ -1666,7 +1677,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
conditions = condition.size;
}
- CLGLI xl = (CLGLI) cl;
+ CLGL xl = (CLGL) cl;
int ret = xl.clEnqueueAcquireGLObjects(ID, glObjectIDs.remaining(), glObjectIDs,
conditions, conditionIDs,
@@ -1735,7 +1746,7 @@ public class CLCommandQueue extends CLObject implements CLResource {
conditions = condition.size;
}
- CLGLI xl = (CLGLI) cl;
+ CLGL xl = (CLGL) cl;
int ret = xl.clEnqueueReleaseGLObjects(ID, glObjectIDs.remaining(), glObjectIDs,
conditions, conditionIDs,
@@ -1784,7 +1795,9 @@ public class CLCommandQueue extends CLObject implements CLResource {
return (Mode.OUT_OF_ORDER_MODE.QUEUE_MODE & properties) != 0;
}
+ @Override
public void release() {
+ super.release();
int ret = cl.clReleaseCommandQueue(ID);
context.onCommandQueueReleased(device, this);
if(ret != CL_SUCCESS) {
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java
index 43755c37..7073e5d3 100644
--- a/src/com/jogamp/opencl/CLContext.java
+++ b/src/com/jogamp/opencl/CLContext.java
@@ -28,12 +28,14 @@
package com.jogamp.opencl;
+import com.jogamp.opencl.llb.CL;
import com.jogamp.common.nio.Buffers;
import com.jogamp.opencl.CLDevice.Type;
import com.jogamp.opencl.CLSampler.AddressingMode;
import com.jogamp.opencl.CLSampler.FilteringMode;
import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.opencl.impl.CLImageFormatImpl;
+import com.jogamp.opencl.llb.CLContextBinding;
+import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -57,7 +59,7 @@ import static java.lang.System.*;
import static com.jogamp.opencl.CLException.*;
import static com.jogamp.common.nio.Buffers.*;
import static com.jogamp.common.os.Platform.*;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
import static com.jogamp.opencl.CLBuffer.*;
import static java.util.Collections.*;
@@ -79,7 +81,7 @@ import static java.util.Collections.*;
*
* @author Michael Bien
*/
-public class CLContext extends CLObject implements CLResource {
+public class CLContext extends CLObjectResource {
protected CLDevice[] devices;
@@ -94,7 +96,7 @@ public class CLContext extends CLObject implements CLResource {
private final ErrorDispatcher errorHandler;
protected CLContext(CLPlatform platform, long contextID, ErrorDispatcher dispatcher) {
- super(CLPlatform.getLowLevelCLInterface(), contextID);
+ super(contextID);
this.platform = platform;
this.programs = synchronizedSet(new HashSet<CLProgram>());
@@ -115,17 +117,17 @@ public class CLContext extends CLObject implements CLResource {
}
- private synchronized void initDevices() {
+ private synchronized void initDevices(CLContextBinding cl) {
if (devices == null) {
PointerBuffer deviceCount = PointerBuffer.allocateDirect(1);
- int ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, 0, null, deviceCount);
+ int ret = cl.clGetContextInfo(ID, CL_CONTEXT_DEVICES, 0, null, deviceCount);
checkForError(ret, "can not enumerate devices");
ByteBuffer deviceIDs = Buffers.newDirectByteBuffer((int)deviceCount.get());
- ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, deviceIDs.capacity(), deviceIDs, null);
+ ret = cl.clGetContextInfo(ID, CL_CONTEXT_DEVICES, deviceIDs.capacity(), deviceIDs, null);
checkForError(ret, "can not enumerate devices");
devices = new CLDevice[deviceIDs.capacity() / (is32Bit() ? 4 : 8)];
@@ -172,7 +174,7 @@ public class CLContext extends CLObject implements CLResource {
PointerBuffer properties = setupContextProperties(platform);
ErrorDispatcher dispatcher = new ErrorDispatcher();
- return new CLContext(platform, createContextFromType(dispatcher, properties, type), dispatcher);
+ return new CLContext(platform, createContextFromType(platform, dispatcher, properties, type), dispatcher);
}
/**
@@ -190,7 +192,7 @@ public class CLContext extends CLObject implements CLResource {
PointerBuffer properties = setupContextProperties(platform);
ErrorDispatcher dispatcher = new ErrorDispatcher();
- CLContext context = new CLContext(platform, createContext(dispatcher, properties, devices), dispatcher);
+ CLContext context = new CLContext(platform, createContext(platform, dispatcher, properties, devices), dispatcher);
if(devices != null) {
for (int i = 0; i < devices.length; i++) {
devices[i].setContext(context);
@@ -199,18 +201,17 @@ public class CLContext extends CLObject implements CLResource {
return context;
}
- protected static long createContextFromType(CLErrorHandler handler, PointerBuffer properties, long deviceType) {
-
+ protected static long createContextFromType(CLPlatform platform, CLErrorHandler handler, PointerBuffer properties, long deviceType) {
IntBuffer status = newDirectIntBuffer(1);
- long context = CLPlatform.getLowLevelCLInterface().clCreateContextFromType(properties, deviceType, handler, status);
+ CLContextBinding cl = platform.getContextBinding();
+ long context = cl.clCreateContextFromType(properties, deviceType, handler, status);
checkForError(status.get(), "can not create CL context");
return context;
}
- protected static long createContext(CLErrorHandler handler, PointerBuffer properties, CLDevice... devices) {
-
+ protected static long createContext(CLPlatform platform, CLErrorHandler handler, PointerBuffer properties, CLDevice... devices) {
IntBuffer status = newDirectIntBuffer(1);
PointerBuffer pb = null;
if(devices != null && devices.length != 0) {
@@ -223,7 +224,8 @@ public class CLContext extends CLObject implements CLResource {
pb.put(i, device.ID);
}
}
- long context = CLPlatform.getLowLevelCLInterface().clCreateContext(properties, pb, handler, status);
+ CLContextBinding cl = platform.getContextBinding();
+ long context = cl.clCreateContext(properties, pb, handler, status);
checkForError(status.get(), "can not create CL context");
@@ -231,12 +233,11 @@ public class CLContext extends CLObject implements CLResource {
}
private static PointerBuffer setupContextProperties(CLPlatform platform) {
-
if(platform == null) {
throw new RuntimeException("no OpenCL installation found");
}
- return PointerBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM)
+ return PointerBuffer.allocateDirect(3).put(CL_CONTEXT_PLATFORM)
.put(platform.ID).put(0) // 0 terminated array
.rewind();
}
@@ -497,6 +498,7 @@ public class CLContext extends CLObject implements CLResource {
*/
@Override
public synchronized void release() {
+ super.release();
try{
//release all resources
@@ -504,15 +506,12 @@ public class CLContext extends CLObject implements CLResource {
release(memoryObjects);
release(samplers);
- for (CLDevice device : getDevices()) {
- Collection<CLCommandQueue> queues = queuesMap.get(device);
- if(queues != null) {
- release(queues);
- }
+ for (List<CLCommandQueue> queues : queuesMap.values()) {
+ release(queues);
}
}finally{
- int ret = cl.clReleaseContext(ID);
+ int ret = platform.getContextBinding().clReleaseContext(ID);
checkForError(ret, "error releasing context");
}
@@ -524,8 +523,10 @@ public class CLContext extends CLObject implements CLResource {
private CLImageFormat[] getSupportedImageFormats(int flags, int type) {
+ CLContextBinding binding = platform.getContextBinding();
+
int[] entries = new int[1];
- int ret = cl.clGetSupportedImageFormats(ID, flags, type, 0, null, entries, 0);
+ int ret = binding.clGetSupportedImageFormats(ID, flags, type, 0, null, entries, 0);
if(ret != CL_SUCCESS) {
throw newException(ret, "error calling clGetSupportedImageFormats");
}
@@ -537,7 +538,7 @@ public class CLContext extends CLObject implements CLResource {
CLImageFormat[] formats = new CLImageFormat[count];
CLImageFormatImpl impl = CLImageFormatImpl.create(newDirectByteBuffer(count * CLImageFormatImpl.size()));
- ret = cl.clGetSupportedImageFormats(ID, flags, type, count, impl, null, 0);
+ ret = binding.clGetSupportedImageFormats(ID, flags, type, count, impl, null);
if(ret != CL_SUCCESS) {
throw newException(ret, "error calling clGetSupportedImageFormats");
}
@@ -629,7 +630,7 @@ public class CLContext extends CLObject implements CLResource {
* Returns all devices associated with this CLContext.
*/
public CLDevice[] getDevices() {
- initDevices();
+ initDevices(platform.getContextBinding());
return devices;
}
@@ -637,7 +638,7 @@ public class CLContext extends CLObject implements CLResource {
* Return the low level OpenCL interface.
*/
public CL getCL() {
- return cl;
+ return getPlatform().getCLBinding();
}
CLDevice getDevice(long dID) {
diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java
index 07f7c5f2..b47deb2b 100644
--- a/src/com/jogamp/opencl/CLDevice.java
+++ b/src/com/jogamp/opencl/CLDevice.java
@@ -40,7 +40,7 @@ import java.util.Map;
import java.util.Scanner;
import java.util.Set;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
/**
* This object represents an OpenCL device.
@@ -57,16 +57,16 @@ public class CLDevice extends CLObject {
private final CLInfoAccessor deviceInfo;
private final CLPlatform platform;
- protected CLDevice(CL cl, CLPlatform platform, long id) {
- super(cl, id);
+ protected CLDevice(CLPlatform platform, long id) {
+ super(id);
this.platform = platform;
- this.deviceInfo = platform.getAccessorFactory().createDeviceInfoAccessor(cl, id);
+ this.deviceInfo = platform.getAccessorFactory().createDeviceInfoAccessor(platform.getDeviceBinding(), id);
}
protected CLDevice(CLContext context, long id) {
super(context, id);
this.platform = context.getPlatform();
- this.deviceInfo = platform.getAccessorFactory().createDeviceInfoAccessor(cl, id);
+ this.deviceInfo = platform.getAccessorFactory().createDeviceInfoAccessor(platform.getDeviceBinding(), id);
}
public CLCommandQueue createCommandQueue() {
diff --git a/src/com/jogamp/opencl/CLEvent.java b/src/com/jogamp/opencl/CLEvent.java
index 928d0d92..d1bfeffc 100644
--- a/src/com/jogamp/opencl/CLEvent.java
+++ b/src/com/jogamp/opencl/CLEvent.java
@@ -29,11 +29,12 @@
package com.jogamp.opencl;
import com.jogamp.opencl.impl.CLTLInfoAccessor;
-import com.jogamp.opencl.impl.CLEventCallback;
+import com.jogamp.opencl.llb.CLEventBinding;
+import com.jogamp.opencl.llb.impl.CLEventCallback;
import com.jogamp.common.nio.PointerBuffer;
import java.nio.Buffer;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
import static com.jogamp.opencl.CLException.*;
/**
@@ -44,13 +45,15 @@ import static com.jogamp.opencl.CLException.*;
* {@link com.jogamp.opencl.CLCommandQueue.Mode#PROFILING_MODE}.
* @author Michael Bien
*/
-public class CLEvent extends CLObject implements CLResource {
+public class CLEvent extends CLObjectResource {
private final CLEventInfoAccessor eventInfo;
private final CLEventProfilingInfoAccessor eventProfilingInfo;
+ private final CLEventBinding binding;
CLEvent(CLContext context, long id) {
super(context, id);
+ binding = context.getPlatform().getEventBinding();
this.eventInfo = new CLEventInfoAccessor();
this.eventProfilingInfo = new CLEventProfilingInfoAccessor();
}
@@ -64,7 +67,7 @@ public class CLEvent extends CLObject implements CLResource {
// apparently only ExecutionStatus.COMPLETE is allowed -> private
private void registerCallback(final CLEventListener callback, ExecutionStatus trigger) {
- cl.clSetEventCallback(ID, trigger.STATUS, new CLEventCallback() {
+ binding.clSetEventCallback(ID, trigger.STATUS, new CLEventCallback() {
@Override public void eventStateChanged(long event, int status) {
callback.eventStateChanged(CLEvent.this, status);
}
@@ -73,7 +76,8 @@ public class CLEvent extends CLObject implements CLResource {
@Override
public void release() {
- int ret = cl.clReleaseEvent(ID);
+ super.release();
+ int ret = binding.clReleaseEvent(ID);
checkForError(ret, "can not release event");
}
@@ -144,7 +148,7 @@ public class CLEvent extends CLObject implements CLResource {
@Override
protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) {
- return cl.clGetEventInfo(ID, name, valueSize, value, valueSizeRet);
+ return binding.clGetEventInfo(ID, name, valueSize, value, valueSizeRet);
}
}
@@ -153,7 +157,7 @@ public class CLEvent extends CLObject implements CLResource {
@Override
protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) {
- return cl.clGetEventProfilingInfo(ID, name, valueSize, value, valueSizeRet);
+ return binding.clGetEventProfilingInfo(ID, name, valueSize, value, valueSizeRet);
}
}
diff --git a/src/com/jogamp/opencl/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java
index 1e882221..53136e2a 100644
--- a/src/com/jogamp/opencl/CLEventList.java
+++ b/src/com/jogamp/opencl/CLEventList.java
@@ -98,10 +98,46 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL
events[size] = new CLEvent(context, IDs.get());
size++;
}
+
+ PointerBuffer getEventBuffer(int index) {
+ return IDs.duplicate();
+ }
+
+ /**
+ * Waits for all events in this list to occur.
+ * If this list is empty this method won't do anything.
+ */
+ public void waitForEvents() {
+ if(size > 0) {
+ events[0].getPlatform().getEventBinding().clWaitForEvents(size, IDsView);
+ }
+ }
+
+ /**
+ * Waits for all events of the specified region in this list to occur.
+ * Will throw IndexOutOfBoundsException if indices are out of bounds.
+ */
+ public void waitForEvents(int start, int range) {
+ if(start+range < size || range <= 0) {
+ throw new IndexOutOfBoundsException("args: [start: "+start+" range: "+range+"], eventcount: "+size);
+ }
+
+ final PointerBuffer view = getEventBuffer(start);
+ getEvent(start).getPlatform().getEventBinding().clWaitForEvents(range, view);
+ }
+
+ /**
+ * Waits for the event with the given index in this list to occur.
+ */
+ public void waitForEvent(int index) {
+ final PointerBuffer view = getEventBuffer(index);
+ getEvent(index).getPlatform().getEventBinding().clWaitForEvents(1, view);
+ }
/**
* Releases all CLEvents in this list.
*/
+ @Override
public void release() {
for (int i = 0; i < size; i++) {
events[i].release();
@@ -115,6 +151,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL
* @deprecated use {@link #release()} instead.
*/
@Deprecated
+ @Override
public final void close() throws Exception {
release();
}
@@ -139,6 +176,11 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL
return events.length;
}
+ public boolean isReleased() {
+ return size == 0;
+ }
+
+ @Override
public Iterator<CLEvent> iterator() {
return new EventIterator(events, size);
}
@@ -167,10 +209,12 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL
this.size = size;
}
+ @Override
public boolean hasNext() {
return index < size;
}
+ @Override
public CLEvent next() {
if(hasNext())
return events[index++];
@@ -178,6 +222,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable<CL
return null;
}
+ @Override
public void remove() {
throw new UnsupportedOperationException("remove() not supported.");
}
diff --git a/src/com/jogamp/opencl/CLException.java b/src/com/jogamp/opencl/CLException.java
index 59eda198..f776730b 100644
--- a/src/com/jogamp/opencl/CLException.java
+++ b/src/com/jogamp/opencl/CLException.java
@@ -28,7 +28,7 @@
package com.jogamp.opencl;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.gl.CLGL.*;
/**
* Main Exception type for runtime OpenCL errors and failed function calls (e.g. returning not CL_SUCCESS).
diff --git a/src/com/jogamp/opencl/CLImage.java b/src/com/jogamp/opencl/CLImage.java
index fa3ab800..e2daff9c 100644
--- a/src/com/jogamp/opencl/CLImage.java
+++ b/src/com/jogamp/opencl/CLImage.java
@@ -30,9 +30,10 @@ package com.jogamp.opencl;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.impl.CLTLInfoAccessor;
+import com.jogamp.opencl.llb.CLImageBinding;
import java.nio.Buffer;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
/**
*
@@ -48,17 +49,21 @@ public abstract class CLImage<B extends Buffer> extends CLMemory<B> {
public final int height;
protected CLImage(CLContext context, B directBuffer, CLImageFormat format, int width, int height, long id, int flags) {
- this(context, directBuffer, format, new CLImageInfoAccessor(context.cl, id), width, height, id, flags);
+ this(context, directBuffer, format, createAccessor(context, id), width, height, id, flags);
}
protected CLImage(CLContext context, B directBuffer, CLImageFormat format, CLImageInfoAccessor accessor, int width, int height, long id, int flags) {
- super(context, directBuffer, getSizeImpl(context.cl, id), id, flags);
+ super(context, directBuffer, getSizeImpl(context, id), id, flags);
this.imageInfo = accessor;
this.format = format;
this.width = width;
this.height = height;
}
+ private static CLImageInfoAccessor createAccessor(CLContext context, long id) {
+ return new CLImageInfoAccessor(context.getPlatform().getImageBinding(), id);
+ }
+
protected static CLImageFormat createUninitializedImageFormat() {
return new CLImageFormat();
}
@@ -104,9 +109,9 @@ public abstract class CLImage<B extends Buffer> extends CLMemory<B> {
protected final static class CLImageInfoAccessor extends CLTLInfoAccessor {
private final long id;
- private final CL cl;
+ private final CLImageBinding cl;
- public CLImageInfoAccessor(CL cl, long id) {
+ public CLImageInfoAccessor(CLImageBinding cl, long id) {
this.cl = cl;
this.id = id;
}
diff --git a/src/com/jogamp/opencl/CLImage2d.java b/src/com/jogamp/opencl/CLImage2d.java
index 9e43e4b2..05ac966a 100644
--- a/src/com/jogamp/opencl/CLImage2d.java
+++ b/src/com/jogamp/opencl/CLImage2d.java
@@ -29,6 +29,7 @@
package com.jogamp.opencl;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.opencl.llb.CLImageBinding;
import java.nio.Buffer;
import java.nio.IntBuffer;
@@ -51,7 +52,7 @@ public class CLImage2d<B extends Buffer> extends CLImage<B> {
static <B extends Buffer> CLImage2d<B> createImage(CLContext context, B directBuffer,
int width, int height, int rowPitch, CLImageFormat format, int flags) {
- CL cl = context.cl;
+ CLImageBinding cl = context.getPlatform().getImageBinding();
IntBuffer err = Buffers.newDirectIntBuffer(1);
B host_ptr = null;
if(isHostPointerFlag(flags)) {
diff --git a/src/com/jogamp/opencl/CLImage3d.java b/src/com/jogamp/opencl/CLImage3d.java
index 4e29e06a..cdea61ad 100644
--- a/src/com/jogamp/opencl/CLImage3d.java
+++ b/src/com/jogamp/opencl/CLImage3d.java
@@ -29,10 +29,11 @@
package com.jogamp.opencl;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.opencl.llb.CLImageBinding;
import java.nio.Buffer;
import java.nio.IntBuffer;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
import static com.jogamp.opencl.CLException.*;
/**
@@ -57,7 +58,7 @@ public class CLImage3d<B extends Buffer> extends CLImage<B> {
static <B extends Buffer> CLImage3d<B> createImage(CLContext context, B directBuffer,
int width, int height, int depth, int rowPitch, int slicePitch, CLImageFormat format, int flags) {
- CL cl = context.cl;
+ CLImageBinding cl = context.getPlatform().getImageBinding();
IntBuffer err = Buffers.newDirectIntBuffer(1);
B host_ptr = null;
if(isHostPointerFlag(flags)) {
diff --git a/src/com/jogamp/opencl/CLImageFormat.java b/src/com/jogamp/opencl/CLImageFormat.java
index 5f014e0d..08fe7c7f 100644
--- a/src/com/jogamp/opencl/CLImageFormat.java
+++ b/src/com/jogamp/opencl/CLImageFormat.java
@@ -28,9 +28,9 @@
package com.jogamp.opencl;
-import com.jogamp.opencl.impl.CLImageFormatImpl;
+import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
/**
* Represents the OpenCL image format with its channeltype and order.
diff --git a/src/com/jogamp/opencl/CLKernel.java b/src/com/jogamp/opencl/CLKernel.java
index b2d783ee..135174c4 100644
--- a/src/com/jogamp/opencl/CLKernel.java
+++ b/src/com/jogamp/opencl/CLKernel.java
@@ -31,11 +31,12 @@ package com.jogamp.opencl;
import com.jogamp.opencl.util.CLUtil;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.opencl.llb.CLKernelBinding;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
import static com.jogamp.common.os.Platform.*;
/**
@@ -49,12 +50,13 @@ import static com.jogamp.common.os.Platform.*;
* @see CLProgram#createCLKernels()
* @author Michael Bien
*/
-public class CLKernel extends CLObject implements CLResource, Cloneable {
+public class CLKernel extends CLObjectResource implements Cloneable {
public final String name;
public final int numArgs;
private final CLProgram program;
+ private final CLKernelBinding binding;
private final ByteBuffer buffer;
@@ -71,15 +73,17 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
this.program = program;
this.buffer = Buffers.newDirectByteBuffer((is32Bit()?4:8)*3);
+ binding = program.getPlatform().getKernelBinding();
+
if(name == null) {
// get function name
PointerBuffer size = PointerBuffer.wrap(buffer);
- int ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, 0, null, size);
+ int ret = binding.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, 0, null, size);
checkForError(ret, "error while asking for kernel function name");
ByteBuffer bb = Buffers.newDirectByteBuffer((int)size.get(0));
- ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, bb.capacity(), bb, null);
+ ret = binding.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, bb.capacity(), bb, null);
checkForError(ret, "error while asking for kernel function name");
this.name = CLUtil.clString2JavaString(bb, bb.capacity());
@@ -88,7 +92,7 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
}
// get number of arguments
- int ret = cl.clGetKernelInfo(ID, CL_KERNEL_NUM_ARGS, buffer.capacity(), buffer, null);
+ int ret = binding.clGetKernelInfo(ID, CL_KERNEL_NUM_ARGS, buffer.capacity(), buffer, null);
checkForError(ret, "error while asking for number of function arguments.");
numArgs = buffer.getInt(0);
@@ -106,6 +110,12 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
return this;
}
+ public CLKernel putArg(short value) {
+ setArg(argIndex, value);
+ argIndex++;
+ return this;
+ }
+
public CLKernel putArg(int value) {
setArg(argIndex, value);
argIndex++;
@@ -167,6 +177,11 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
return this;
}
+ public CLKernel setArg(int argumentIndex, short value) {
+ setArgument(argumentIndex, 2, wrap(value));
+ return this;
+ }
+
public CLKernel setArg(int argumentIndex, int value) {
setArgument(argumentIndex, 4, wrap(value));
return this;
@@ -205,6 +220,31 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
return this;
}
+ public CLKernel setArgs(Object... values) {
+ if(values == null || values.length == 0) {
+ throw new IllegalArgumentException("values array was empty or null.");
+ }
+ for (int i = 0; i < values.length; i++) {
+ Object value = values[i];
+ if(value instanceof CLMemory<?>) {
+ setArg(i, (CLMemory<?>)value);
+ }else if(value instanceof Short) {
+ setArg(i, (Short)value);
+ }else if(value instanceof Integer) {
+ setArg(i, (Integer)value);
+ }else if(value instanceof Long) {
+ setArg(i, (Long)value);
+ }else if(value instanceof Float) {
+ setArg(i, (Float)value);
+ }else if(value instanceof Double) {
+ setArg(i, (Double)value);
+ }else{
+ throw new IllegalArgumentException(value + " is not a valid argument.");
+ }
+ }
+ return this;
+ }
+
private void setArgs(int startIndex, CLMemory<?>... values) {
for (int i = 0; i < values.length; i++) {
setArg(i+startIndex, values[i]);
@@ -221,7 +261,7 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
" arguments for a not executable program. "+program);
}
- int ret = cl.clSetKernelArg(ID, argumentIndex, size, value);
+ int ret = binding.clSetKernelArg(ID, argumentIndex, size, value);
if(ret != CL_SUCCESS) {
throw newException(ret, "error setting arg "+argumentIndex+" to value "+value+" of size "+size+" of "+this);
}
@@ -255,6 +295,10 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
return buffer.putDouble(0, value);
}
+ private Buffer wrap(short value) {
+ return buffer.putShort(0, value);
+ }
+
private Buffer wrap(int value) {
return buffer.putInt(0, value);
}
@@ -293,7 +337,7 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
* The returned array has always three elements.
*/
public long[] getCompileWorkGroupSize(CLDevice device) {
- int ret = cl.clGetKernelWorkGroupInfo(ID, device.ID, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, (is32Bit()?4:8)*3, buffer, null);
+ int ret = binding.clGetKernelWorkGroupInfo(ID, device.ID, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, (is32Bit()?4:8)*3, buffer, null);
if(ret != CL_SUCCESS) {
throw newException(ret, "error while asking for CL_KERNEL_COMPILE_WORK_GROUP_SIZE of "+this+" on "+device);
}
@@ -306,7 +350,7 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
}
private long getWorkGroupInfo(CLDevice device, int flag) {
- int ret = cl.clGetKernelWorkGroupInfo(ID, device.ID, flag, 8, buffer, null);
+ int ret = binding.clGetKernelWorkGroupInfo(ID, device.ID, flag, 8, buffer, null);
if(ret != CL_SUCCESS) {
throw newException(ret, "error while asking for clGetKernelWorkGroupInfo of "+this+" on "+device);
}
@@ -316,10 +360,12 @@ public class CLKernel extends CLObject implements CLResource, Cloneable {
/**
* Releases all resources of this kernel from its context.
*/
+ @Override
public void release() {
- int ret = cl.clReleaseKernel(ID);
+ super.release();
+ int ret = binding.clReleaseKernel(ID);
program.onKernelReleased(this);
- if(ret != CL.CL_SUCCESS) {
+ if(ret != CL_SUCCESS) {
throw newException(ret, "can not release "+this);
}
}
diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java
index a1ca4848..281d042f 100644
--- a/src/com/jogamp/opencl/CLMemory.java
+++ b/src/com/jogamp/opencl/CLMemory.java
@@ -28,10 +28,11 @@
package com.jogamp.opencl;
-import com.jogamp.opencl.gl.CLGLI;
+import com.jogamp.opencl.llb.CLMemObjBinding;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.opencl.impl.CLMemObjectDestructorCallback;
+import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.llb.impl.CLMemObjectDestructorCallback;
import java.nio.Buffer;
import java.nio.IntBuffer;
import java.util.ArrayList;
@@ -39,14 +40,14 @@ import java.util.EnumSet;
import java.util.List;
import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.opencl.gl.CLGLI.*;
+import static com.jogamp.opencl.llb.gl.CLGL.*;
/**
* Common superclass for all OpenCL memory types.
* Represents an OpenCL memory object and wraps an optional NIO buffer.
* @author Michael Bien
*/
-public abstract class CLMemory <B extends Buffer> extends CLObject implements CLResource {
+public abstract class CLMemory <B extends Buffer> extends CLObjectResource {
B buffer;
protected final int FLAGS;
@@ -55,6 +56,8 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL
// depends on the nio buffer type
protected int elementSize;
protected int clCapacity;
+
+ private final CLMemObjBinding binding;
protected <Buffer> CLMemory(CLContext context, long size, long id, int flags) {
this(context, null, size, id, flags);
@@ -65,6 +68,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL
this.buffer = directBuffer;
this.FLAGS = flags;
this.size = size;
+ this.binding = context.getPlatform().getMemObjectBinding();
initElementSize();
initCLCapacity();
}
@@ -85,15 +89,16 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL
|| (flags & CL_MEM_USE_HOST_PTR) != 0;
}
- protected static long getSizeImpl(CL cl, long id) {
+ protected static long getSizeImpl(CLContext context, long id) {
PointerBuffer pb = PointerBuffer.allocateDirect(1);
- int ret = cl.clGetMemObjectInfo(id, CL_MEM_SIZE, pb.elementSize(), pb.getBuffer(), null);
+ CLMemObjBinding binding = context.getPlatform().getMemObjectBinding(); // FIXME: CL separation makes this pretty complicated !
+ int ret = binding.clGetMemObjectInfo(id, CL_MEM_SIZE, pb.elementSize(), pb.getBuffer(), null);
checkForError(ret, "can not obtain buffer info");
return pb.get();
}
protected static CL getCL(CLContext context) {
- return context.cl;
+ return context.getCL();
}
/**
@@ -101,7 +106,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL
* when the memory object is released.
*/
public void registerDestructorCallback(final CLMemObjectListener listener) {
- cl.clSetMemObjectDestructorCallback(ID, new CLMemObjectDestructorCallback() {
+ binding.clSetMemObjectDestructorCallback(ID, new CLMemObjectDestructorCallback() {
@Override
public void memoryDeallocated(long memObjID) {
listener.memoryDeallocated(CLMemory.this);
@@ -189,7 +194,7 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL
*/
public int getMapCount() {
IntBuffer value = Buffers.newDirectIntBuffer(1);
- int ret = cl.clGetMemObjectInfo(ID, CL_MEM_MAP_COUNT, 4, value, null);
+ int ret = binding.clGetMemObjectInfo(ID, CL_MEM_MAP_COUNT, 4, value, null);
checkForError(ret, "can not obtain buffer map count.");
return value.get();
}
@@ -217,7 +222,8 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL
@Override
public void release() {
- int ret = cl.clReleaseMemObject(ID);
+ super.release();
+ int ret = binding.clReleaseMemObject(ID);
context.onMemoryReleased(this);
if(ret != CL_SUCCESS) {
throw newException(ret, "can not release "+this);
@@ -228,24 +234,24 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL
/**
* Returns the OpenGL buffer type of this shared buffer.
*/
- @Deprecated
- /*public*/ final GLObjectType _getGLObjectType() {
- int[] array = new int[1];
- int ret = ((CLGLI)cl).clGetGLObjectInfo(ID, array, 0, null, 0);
- CLException.checkForError(ret, "error while asking for gl object info");
- return GLObjectType.valueOf(array[0]);
- }
-
- /**
- * Returns the OpenGL object id of this shared buffer.
- */
- @Deprecated
- /*public*/ final int _getGLObjectID() {
- int[] array = new int[1];
- int ret = ((CLGLI)cl).clGetGLObjectInfo(ID, null, 0, array, 0);
- CLException.checkForError(ret, "error while asking for gl object info");
- return array[0];
- }
+// @Deprecated
+// /*public*/ final GLObjectType _getGLObjectType() {
+// int[] array = new int[1];
+// int ret = ((CLGL)cl).clGetGLObjectInfo(ID, array, 0, null, 0);
+// CLException.checkForError(ret, "error while asking for gl object info");
+// return GLObjectType.valueOf(array[0]);
+// }
+//
+// /**
+// * Returns the OpenGL object id of this shared buffer.
+// */
+// @Deprecated
+// /*public*/ final int _getGLObjectID() {
+// int[] array = new int[1];
+// int ret = ((CLGL)cl).clGetGLObjectInfo(ID, null, 0, array, 0);
+// CLException.checkForError(ret, "error while asking for gl object info");
+// return array[0];
+// }
@Override
public boolean equals(Object obj) {
diff --git a/src/com/jogamp/opencl/CLObject.java b/src/com/jogamp/opencl/CLObject.java
index 54031884..58a6333c 100644
--- a/src/com/jogamp/opencl/CLObject.java
+++ b/src/com/jogamp/opencl/CLObject.java
@@ -28,13 +28,12 @@
package com.jogamp.opencl;
-import com.jogamp.common.AutoCloseable;
/**
* Common superclass for all OpenCL objects.
* @author Michael Bien
*/
-abstract class CLObject implements AutoCloseable {
+public abstract class CLObject {
/**
* The OpenCL object handle.
@@ -43,34 +42,17 @@ abstract class CLObject implements AutoCloseable {
protected CLContext context;
- protected final CL cl;
-
- CLObject(CL cl, long ID) {
- this.cl = cl;
+ CLObject(long ID) {
this.context = null;
this.ID = ID;
}
CLObject(CLContext context, long ID) {
- this.cl = context.cl;
this.context = context;
this.ID = ID;
}
/**
- * Implementation detail.
- * TODO remove as soon we have extension methods.
- * @deprecated This method is not intended to be called from client code.
- * @see java.lang.AutoCloseable
- */
- @Deprecated
- public final void close() {
- if(this instanceof CLResource) {
- ((CLResource)this).release();
- }
- }
-
- /**
* Returns the context for this OpenCL object.
*/
public CLContext getContext() {
diff --git a/src/com/jogamp/opencl/CLObjectResource.java b/src/com/jogamp/opencl/CLObjectResource.java
new file mode 100644
index 00000000..fcea22c1
--- /dev/null
+++ b/src/com/jogamp/opencl/CLObjectResource.java
@@ -0,0 +1,51 @@
+/*
+ * Created on Saturday, June 18 2011 02:36
+ */
+package com.jogamp.opencl;
+
+import com.jogamp.common.AutoCloseable;
+
+/**
+ * Releasable resource with an CL object ID.
+ * @author Michael Bien
+ */
+abstract class CLObjectResource extends CLObject implements CLResource, AutoCloseable {
+
+ private boolean released;
+
+ public CLObjectResource(long ID) {
+ super(ID);
+ }
+
+ public CLObjectResource(CLContext context, long ID) {
+ super(context, ID);
+ }
+
+ public void release() {
+ if(released) {
+ throw new RuntimeException(getClass().getSimpleName()+" was already released.");
+ }else{
+ released = true;
+ }
+ }
+
+ /**
+ * Implementation detail.
+ * TODO remove as soon we have extension methods.
+ * @deprecated This method is not intended to be called from client code.
+ * @see java.lang.AutoCloseable
+ */
+ @Deprecated
+ @Override
+ public final void close() {
+ if(this instanceof CLResource) {
+ ((CLResource)this).release();
+ }
+ }
+
+ public boolean isReleased() {
+ return released;
+ }
+
+
+}
diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java
index ab2e32b0..bd93caa3 100644
--- a/src/com/jogamp/opencl/CLPlatform.java
+++ b/src/com/jogamp/opencl/CLPlatform.java
@@ -28,6 +28,12 @@
package com.jogamp.opencl;
+import com.jogamp.opencl.llb.CLPlatformBinding;
+import com.jogamp.opencl.llb.CLProgramBinding;
+import com.jogamp.opencl.llb.CLSamplerBinding;
+import com.jogamp.opencl.llb.CLKernelBinding;
+import com.jogamp.opencl.llb.CLImageBinding;
+import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.impl.CLTLAccessorFactory;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.os.DynamicLookupHelper;
@@ -35,10 +41,16 @@ import com.jogamp.common.JogampRuntimeException;
import com.jogamp.common.os.NativeLibrary;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.gluegen.runtime.FunctionAddressResolver;
+import com.jogamp.opencl.llb.CLBufferBinding;
+import com.jogamp.opencl.llb.CLCommandQueueBinding;
+import com.jogamp.opencl.llb.CLContextBinding;
+import com.jogamp.opencl.llb.CLDeviceBinding;
+import com.jogamp.opencl.llb.CLEventBinding;
+import com.jogamp.opencl.llb.CLMemObjBinding;
import com.jogamp.opencl.spi.CLPlatformInfoAccessor;
import com.jogamp.opencl.util.CLUtil;
-import com.jogamp.opencl.impl.CLImpl;
-import com.jogamp.opencl.impl.CLProcAddressTable;
+import com.jogamp.opencl.llb.impl.CLImpl;
+import com.jogamp.opencl.llb.impl.CLProcAddressTable;
import com.jogamp.opencl.spi.CLAccessorFactory;
import com.jogamp.opencl.util.Filter;
import com.jogamp.opencl.util.JOCLVersion;
@@ -55,7 +67,7 @@ import java.security.PrivilegedAction;
import static java.security.AccessController.*;
import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
/**
* CLPlatfrorm representing a OpenCL implementation (e.g. graphics driver).
@@ -346,7 +358,7 @@ public class CLPlatform {
}
protected CLDevice createDevice(long id) {
- return new CLDevice(cl, this, id);
+ return new CLDevice(this, id);
}
private static <I> void addIfAccepted(I item, List<I> list, Filter<I>[] filters) {
@@ -538,9 +550,57 @@ public class CLPlatform {
return info;
}
+ protected CLBufferBinding getBufferBinding() {
+ return cl;
+ }
+
+ protected CLCommandQueueBinding getCommandQueueBinding() {
+ return cl;
+ }
+
+ protected CLContextBinding getContextBinding() {
+ return cl;
+ }
+
+ protected CLDeviceBinding getDeviceBinding() {
+ return cl;
+ }
+
+ protected CLEventBinding getEventBinding() {
+ return cl;
+ }
+
+ protected CLImageBinding getImageBinding() {
+ return cl;
+ }
+
+ protected CLKernelBinding getKernelBinding() {
+ return cl;
+ }
+
+ protected CLMemObjBinding getMemObjectBinding() {
+ return cl;
+ }
+
+ protected CLPlatformBinding getPlatformBinding() {
+ return cl;
+ }
+
+ protected CLProgramBinding getProgramBinding() {
+ return cl;
+ }
+
+ protected CLSamplerBinding getSamplerBinding() {
+ return cl;
+ }
+
+ protected CL getCLBinding() {
+ return cl;
+ }
+
@Override
public String toString() {
- return "CLPlatform [name: " + getName()
+ return getClass().getSimpleName()+" [name: " + getName()
+", vendor: "+getVendor()
+", profile: "+getProfile()
+", version: "+getVersion()+"]";
diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java
index 53c2e1d9..d373d5d3 100644
--- a/src/com/jogamp/opencl/CLProgram.java
+++ b/src/com/jogamp/opencl/CLProgram.java
@@ -29,12 +29,13 @@
package com.jogamp.opencl;
import com.jogamp.common.nio.CachedBufferFactory;
+import com.jogamp.opencl.llb.CLProgramBinding;
import com.jogamp.opencl.util.CLProgramConfiguration;
import com.jogamp.opencl.util.CLUtil;
import com.jogamp.common.os.Platform;
import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.opencl.impl.BuildProgramCallback;
+import com.jogamp.opencl.llb.CLKernelBinding;
+import com.jogamp.opencl.llb.impl.BuildProgramCallback;
import com.jogamp.opencl.util.CLBuildListener;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
@@ -48,7 +49,7 @@ import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
import static com.jogamp.common.nio.Buffers.*;
/**
@@ -59,9 +60,10 @@ import static com.jogamp.common.nio.Buffers.*;
* @see CLContext#createProgram(java.util.Map)
* @author Michael Bien
*/
-public class CLProgram extends CLObject implements CLResource {
+public class CLProgram extends CLObjectResource {
private final static ReentrantLock buildLock = new ReentrantLock();
+ private final CLProgramBinding binding;
private final Set<CLKernel> kernels;
private Map<CLDevice, Status> buildStatusMap;
@@ -72,6 +74,7 @@ public class CLProgram extends CLObject implements CLResource {
private CLProgram(CLContext context, long id) {
super(context, id);
this.kernels = new HashSet<CLKernel>();
+ this.binding = context.getPlatform().getProgramBinding();
}
static CLProgram create(CLContext context, String src) {
@@ -82,7 +85,8 @@ public class CLProgram extends CLObject implements CLResource {
String[] srcArray = new String[] {src};
// Create the program
- long id = context.cl.clCreateProgramWithSource(context.ID, 1, srcArray, length, status);
+ CLProgramBinding binding = context.getPlatform().getProgramBinding();
+ long id = binding.clCreateProgramWithSource(context.ID, 1, srcArray, length, status);
int err = status.get();
if(err != CL_SUCCESS) {
@@ -127,7 +131,8 @@ public class CLProgram extends CLObject implements CLResource {
IntBuffer errBuffer = bf.newDirectIntBuffer(1);
// IntBuffer status = newDirectByteBuffer(binaries.size()*4).asIntBuffer();
- long id = context.cl.clCreateProgramWithBinary(context.ID, devices.capacity(), devices, lengths, codeBuffers, /*status*/null, errBuffer);
+ CLProgramBinding binding = context.getPlatform().getProgramBinding();
+ long id = binding.clCreateProgramWithBinary(context.ID, devices.capacity(), devices, lengths, codeBuffers, /*status*/null, errBuffer);
// while(status.remaining() != 0) {
// checkForError(status.get(), "unable to load binaries on all devices");
@@ -167,14 +172,14 @@ public class CLProgram extends CLObject implements CLResource {
PointerBuffer size = PointerBuffer.allocateDirect(1);
- int ret = cl.clGetProgramBuildInfo(ID, device.ID, flag, 0, null, size);
+ int ret = binding.clGetProgramBuildInfo(ID, device.ID, flag, 0, null, size);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramBuildInfo with "+device);
}
ByteBuffer buffer = newDirectByteBuffer((int)size.get(0));
- ret = cl.clGetProgramBuildInfo(ID, device.ID, flag, buffer.capacity(), buffer, null);
+ ret = binding.clGetProgramBuildInfo(ID, device.ID, flag, buffer.capacity(), buffer, null);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramBuildInfo with "+device);
}
@@ -190,12 +195,12 @@ public class CLProgram extends CLObject implements CLResource {
PointerBuffer size = PointerBuffer.allocateDirect(1);
- int ret = cl.clGetProgramInfo(ID, flag, 0, null, size);
+ int ret = binding.clGetProgramInfo(ID, flag, 0, null, size);
checkForError(ret, "on clGetProgramInfo");
ByteBuffer buffer = newDirectByteBuffer((int)size.get(0));
- ret = cl.clGetProgramInfo(ID, flag, buffer.capacity(), buffer, null);
+ ret = binding.clGetProgramInfo(ID, flag, buffer.capacity(), buffer, null);
checkForError(ret, "on clGetProgramInfo");
return CLUtil.clString2JavaString(buffer, (int)size.get(0));
@@ -205,12 +210,15 @@ public class CLProgram extends CLObject implements CLResource {
ByteBuffer buffer = newDirectByteBuffer(4);
- int ret = cl.clGetProgramBuildInfo(ID, device.ID, flag, buffer.capacity(), buffer, null);
+ int ret = binding.clGetProgramBuildInfo(ID, device.ID, flag, buffer.capacity(), buffer, null);
checkForError(ret, "error on clGetProgramBuildInfo");
return buffer.getInt();
}
+ private CLKernelBinding getKernelBinding() {
+ return getPlatform().getKernelBinding();
+ }
/**
* Builds this program for all devices associated with the context.
@@ -369,7 +377,7 @@ public class CLProgram extends CLObject implements CLResource {
buildLock.lock();
boolean exception = true;
try{
- ret = cl.clBuildProgram(ID, count, deviceIDs, options, callback);
+ ret = binding.clBuildProgram(ID, count, deviceIDs, options, callback);
exception = false;
}finally{
if(callback == null || exception) {
@@ -402,7 +410,7 @@ public class CLProgram extends CLObject implements CLResource {
}
int[] err = new int[1];
- long id = cl.clCreateKernel(ID, kernelName, err, 0);
+ long id = getKernelBinding().clCreateKernel(ID, kernelName, err, 0);
if(err[0] != CL_SUCCESS) {
throw newException(err[0], "unable to create Kernel with name: "+kernelName);
}
@@ -424,7 +432,8 @@ public class CLProgram extends CLObject implements CLResource {
HashMap<String, CLKernel> newKernels = new HashMap<String, CLKernel>();
IntBuffer numKernels = newDirectByteBuffer(4).asIntBuffer();
- int ret = cl.clCreateKernelsInProgram(ID, 0, null, numKernels);
+ CLKernelBinding kernelBinding = getKernelBinding();
+ int ret = kernelBinding.clCreateKernelsInProgram(ID, 0, null, numKernels);
if(ret != CL_SUCCESS) {
throw newException(ret, "can not create kernels for "+this);
}
@@ -432,7 +441,7 @@ public class CLProgram extends CLObject implements CLResource {
if(numKernels.get(0) > 0) {
PointerBuffer kernelIDs = PointerBuffer.allocateDirect(numKernels.get(0));
- ret = cl.clCreateKernelsInProgram(ID, kernelIDs.capacity(), kernelIDs, null);
+ ret = kernelBinding.clCreateKernelsInProgram(ID, kernelIDs.capacity(), kernelIDs, null);
if(ret != CL_SUCCESS) {
throw newException(ret, "can not create "+kernelIDs.capacity()+" kernels for "+this);
}
@@ -465,13 +474,14 @@ public class CLProgram extends CLObject implements CLResource {
@Override
public void release() {
+ super.release();
releaseKernels();
executable = false;
released = true;
buildStatusMap = null;
-
- int ret = cl.clReleaseProgram(ID);
+
+ int ret = binding.clReleaseProgram(ID);
context.onProgramReleased(this);
if(ret != CL_SUCCESS) {
throw newException(ret, "can not release "+this);
@@ -495,14 +505,15 @@ public class CLProgram extends CLObject implements CLResource {
if(released) {
return new CLDevice[0];
}
+
PointerBuffer size = PointerBuffer.allocateDirect(1);
- int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, 0, null, size);
+ int ret = binding.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, 0, null, size);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramInfo of "+this);
}
ByteBuffer bb = newDirectByteBuffer((int) size.get(0));
- ret = cl.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, bb.capacity(), bb, null);
+ ret = binding.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, bb.capacity(), bb, null);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramInfo of "+this);
}
@@ -606,7 +617,7 @@ public class CLProgram extends CLObject implements CLResource {
CLDevice[] devices = getCLDevices();
PointerBuffer sizes = PointerBuffer.allocateDirect(devices.length);
- int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity()*sizes.elementSize(), sizes.getBuffer(), null);
+ int ret = binding.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity()*sizes.elementSize(), sizes.getBuffer(), null);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARY_SIZES) of "+this);
}
@@ -628,7 +639,7 @@ public class CLProgram extends CLObject implements CLResource {
}
addresses.rewind();
- ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity()*addresses.elementSize(), addresses.getBuffer(), null);
+ ret = binding.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity()*addresses.elementSize(), addresses.getBuffer(), null);
if(ret != CL_SUCCESS) {
throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARIES) of "+this);
}
diff --git a/src/com/jogamp/opencl/CLResource.java b/src/com/jogamp/opencl/CLResource.java
index 4918e725..cd14c59c 100644
--- a/src/com/jogamp/opencl/CLResource.java
+++ b/src/com/jogamp/opencl/CLResource.java
@@ -39,4 +39,8 @@ public interface CLResource {
*/
public void release();
+ /**
+ * Returns true if {@link #release()} has been called.
+ */
+ public boolean isReleased();
}
diff --git a/src/com/jogamp/opencl/CLSampler.java b/src/com/jogamp/opencl/CLSampler.java
index 8632143b..f19f58de 100644
--- a/src/com/jogamp/opencl/CLSampler.java
+++ b/src/com/jogamp/opencl/CLSampler.java
@@ -30,11 +30,12 @@ package com.jogamp.opencl;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.opencl.impl.CLTLInfoAccessor;
+import com.jogamp.opencl.llb.CLSamplerBinding;
import java.nio.Buffer;
import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
import static com.jogamp.opencl.util.CLUtil.*;
/**
@@ -42,19 +43,22 @@ import static com.jogamp.opencl.util.CLUtil.*;
* @see CLContext#createSampler(com.jogamp.opencl.CLSampler.AddressingMode, com.jogamp.opencl.CLSampler.FilteringMode, boolean)
* @author Michael Bien
*/
-public class CLSampler extends CLObject implements CLResource {
+public class CLSampler extends CLObjectResource {
private final CLSamplerInfoAccessor samplerInfo;
+ private final CLSamplerBinding binding;
private CLSampler(CLContext context, long id, AddressingMode addrMode, FilteringMode filtMode, boolean normalizedCoords) {
super(context, id);
+ this.binding = context.getPlatform().getSamplerBinding();
this.samplerInfo = new CLSamplerInfoAccessor();
}
static CLSampler create(CLContext context, AddressingMode addrMode, FilteringMode filtMode, boolean normalizedCoords) {
int[] error = new int[1];
- long id = context.cl.clCreateSampler(context.ID, clBoolean(normalizedCoords), addrMode.MODE, filtMode.MODE, error, 0);
+ CLSamplerBinding binding = context.getPlatform().getSamplerBinding();
+ long id = binding.clCreateSampler(context.ID, clBoolean(normalizedCoords), addrMode.MODE, filtMode.MODE, error, 0);
checkForError(error[0], "can not create sampler");
return new CLSampler(context, id, addrMode, filtMode, normalizedCoords);
@@ -76,9 +80,10 @@ public class CLSampler extends CLObject implements CLResource {
@Override
public void release() {
- int ret = cl.clReleaseSampler(ID);
+ super.release();
+ int ret = binding.clReleaseSampler(ID);
context.onSamplerReleased(this);
- if(ret != CL.CL_SUCCESS) {
+ if(ret != CL_SUCCESS) {
throw newException(ret, "can not release "+this);
}
}
@@ -87,7 +92,7 @@ public class CLSampler extends CLObject implements CLResource {
@Override
protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) {
- return cl.clGetSamplerInfo(ID, name, valueSize, value, valueSizeRet);
+ return binding.clGetSamplerInfo(ID, name, valueSize, value, valueSizeRet);
}
}
diff --git a/src/com/jogamp/opencl/CLUserEvent.java b/src/com/jogamp/opencl/CLUserEvent.java
index 4bbbf3b8..d1a9da70 100644
--- a/src/com/jogamp/opencl/CLUserEvent.java
+++ b/src/com/jogamp/opencl/CLUserEvent.java
@@ -33,7 +33,8 @@
package com.jogamp.opencl;
import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
+import com.jogamp.opencl.llb.CLEventBinding;
/**
* Custom, user controlled event.
@@ -50,8 +51,9 @@ public class CLUserEvent extends CLEvent {
* Creates a new user event.
*/
public static CLUserEvent create(CLContext context) {
+ CLEventBinding binding = context.getPlatform().getEventBinding();
int[] error = new int[1];
- long ID = context.cl.clCreateUserEvent(context.ID, error, 0);
+ long ID = binding.clCreateUserEvent(context.ID, error, 0);
checkForError(error[0], "can not create user event.");
return new CLUserEvent(context, ID);
}
@@ -61,7 +63,8 @@ public class CLUserEvent extends CLEvent {
* Calls {@native clSetUserEventStatus}.
*/
public CLUserEvent setStatus(CLEvent.ExecutionStatus status) {
- int err = cl.clSetUserEventStatus(ID, status.STATUS);
+ CLEventBinding binding = getPlatform().getEventBinding();
+ int err = binding.clSetUserEventStatus(ID, status.STATUS);
if(err != CL_SUCCESS) {
newException(err, "can not set status "+status);
}
diff --git a/src/com/jogamp/opencl/gl/CLGLBuffer.java b/src/com/jogamp/opencl/gl/CLGLBuffer.java
index 148aa83d..7d41b0eb 100644
--- a/src/com/jogamp/opencl/gl/CLGLBuffer.java
+++ b/src/com/jogamp/opencl/gl/CLGLBuffer.java
@@ -32,6 +32,7 @@ import com.jogamp.opencl.CLBuffer;
import com.jogamp.opencl.CLCommandQueue;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLException;
+import com.jogamp.opencl.llb.gl.CLGL;
import java.nio.Buffer;
import javax.media.opengl.GLContext;
@@ -58,7 +59,7 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C
static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, long size, int flags, int glObject) {
checkBuffer(directBuffer, flags);
- CLGLI clgli = (CLGLI)getCL(context);
+ CLGL clgli = (CLGL)getCL(context);
int[] result = new int[1];
long id = clgli.clCreateFromGLBuffer(context.ID, flags, glObject, result, 0);
@@ -82,14 +83,16 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C
* {@link CLCommandQueue#putAcquireGLObject(com.jogamp.opencl.gl.CLGLObject)}.
*/
public void updateSize() {
- size = getSizeImpl(cl, ID);
+ size = getSizeImpl(context, ID);
initCLCapacity();
}
+ @Override
public int getGLObjectID() {
return GLID;
}
+ @Override
public GLObjectType getGLObjectType() {
return GLObjectType.GL_OBJECT_BUFFER;
}
@@ -99,6 +102,7 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> implements C
return (CLGLContext) super.getContext();
}
+ @Override
public GLContext getGLContext() {
return getContext().getGLContext();
}
diff --git a/src/com/jogamp/opencl/gl/CLGLContext.java b/src/com/jogamp/opencl/gl/CLGLContext.java
index 5f12d033..dcddd3df 100644
--- a/src/com/jogamp/opencl/gl/CLGLContext.java
+++ b/src/com/jogamp/opencl/gl/CLGLContext.java
@@ -28,6 +28,7 @@
package com.jogamp.opencl.gl;
+import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLDevice;
import java.nio.Buffer;
@@ -42,7 +43,7 @@ import jogamp.opengl.windows.wgl.WindowsWGLContext;
import jogamp.opengl.x11.glx.X11GLXContext;
import javax.media.opengl.GLContext;
-import static com.jogamp.opencl.gl.CLGLI.*;
+import static com.jogamp.opencl.llb.gl.CLGL.*;
/**
* OpenCL Context supporting JOGL-JOCL interoperablity.
@@ -98,7 +99,7 @@ public final class CLGLContext extends CLContext {
long[] glID = new long[1];
PointerBuffer properties = setupContextProperties(platform, glContext, glID);
ErrorDispatcher dispatcher = createErrorHandler();
- long clID = createContextFromType(dispatcher, properties, toDeviceBitmap(deviceTypes));
+ long clID = createContextFromType(platform, dispatcher, properties, toDeviceBitmap(deviceTypes));
return new CLGLContext(platform, glContext, clID, glID[0], dispatcher);
@@ -122,7 +123,7 @@ public final class CLGLContext extends CLContext {
long[] glID = new long[1];
PointerBuffer properties = setupContextProperties(platform, glContext, glID);
ErrorDispatcher dispatcher = createErrorHandler();
- long clID = createContext(dispatcher, properties, devices);
+ long clID = createContext(platform, dispatcher, properties, devices);
CLGLContext context = new CLGLContext(platform, glContext, clID, glID[0], dispatcher);
if(devices != null) {
@@ -308,8 +309,8 @@ public final class CLGLContext extends CLContext {
* Return the low level OpenCL interface with OpenGL interoperability.
*/
@Override
- public CLGLI getCL() {
- return (CLGLI)super.getCL();
+ public CLGL getCL() {
+ return (CLGL)super.getCL();
}
/**
diff --git a/src/com/jogamp/opencl/gl/CLGLImage2d.java b/src/com/jogamp/opencl/gl/CLGLImage2d.java
index 94ad7e84..dd6b9d5a 100644
--- a/src/com/jogamp/opencl/gl/CLGLImage2d.java
+++ b/src/com/jogamp/opencl/gl/CLGLImage2d.java
@@ -28,15 +28,16 @@
package com.jogamp.opencl.gl;
-import com.jogamp.opencl.CL;
+import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.llb.gl.CLGL;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLImage2d;
import com.jogamp.opencl.CLImageFormat;
-import com.jogamp.opencl.impl.CLImageFormatImpl;
+import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
import java.nio.Buffer;
import javax.media.opengl.GLContext;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
/**
* 2D OpenCL image representing an OpenGL renderbuffer.
@@ -60,7 +61,7 @@ public class CLGLImage2d<B extends Buffer> extends CLImage2d<B> implements CLGLO
CL cl = getCL(context);
int[] result = new int[1];
- CLGLI clgli = (CLGLI)cl;
+ CLGL clgli = (CLGL)cl;
long id = clgli.clCreateFromGLRenderbuffer(context.ID, flags, glObject, result, 0);
@@ -94,6 +95,7 @@ public class CLGLImage2d<B extends Buffer> extends CLImage2d<B> implements CLGLO
return (CLGLContext) super.getContext();
}
+ @Override
public GLContext getGLContext() {
return getContext().getGLContext();
}
diff --git a/src/com/jogamp/opencl/gl/CLGLTexture2d.java b/src/com/jogamp/opencl/gl/CLGLTexture2d.java
index faf1bdc8..7cbd95d5 100644
--- a/src/com/jogamp/opencl/gl/CLGLTexture2d.java
+++ b/src/com/jogamp/opencl/gl/CLGLTexture2d.java
@@ -28,13 +28,15 @@
package com.jogamp.opencl.gl;
-import com.jogamp.opencl.CL;
+import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLImageFormat;
-import com.jogamp.opencl.impl.CLImageFormatImpl;
+import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
+import com.jogamp.opencl.llb.gl.CLGL;
import java.nio.Buffer;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.CLException.*;
+import static com.jogamp.opencl.llb.CL.*;
/**
* 2D OpenCL image representing an 2D OpenGL texture.
@@ -58,9 +60,10 @@ public class CLGLTexture2d<B extends Buffer> extends CLGLImage2d<B> implements C
CL cl = getCL(context);
int[] result = new int[1];
- CLGLI clgli = (CLGLI)cl;
+ CLGL clgli = (CLGL)cl;
long id = clgli.clCreateFromGLTexture2D(context.ID, flags, target, mipLevel, texture, result, 0);
+ checkForError((int)id, "can not share memory with texture #"+texture+".");
CLImageInfoAccessor accessor = new CLImageInfoAccessor(cl, id);
@@ -74,10 +77,12 @@ public class CLGLTexture2d<B extends Buffer> extends CLGLImage2d<B> implements C
}
+ @Override
public int getTextureTarget() {
return target;
}
+ @Override
public int getMipMapLevel() {
return mipMapLevel;
}
diff --git a/src/com/jogamp/opencl/gl/CLGLTexture3d.java b/src/com/jogamp/opencl/gl/CLGLTexture3d.java
index ace779d9..8dd2682c 100644
--- a/src/com/jogamp/opencl/gl/CLGLTexture3d.java
+++ b/src/com/jogamp/opencl/gl/CLGLTexture3d.java
@@ -28,15 +28,16 @@
package com.jogamp.opencl.gl;
-import com.jogamp.opencl.CL;
+import com.jogamp.opencl.llb.gl.CLGL;
+import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.CLContext;
import com.jogamp.opencl.CLImage3d;
import com.jogamp.opencl.CLImageFormat;
-import com.jogamp.opencl.impl.CLImageFormatImpl;
+import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
import java.nio.Buffer;
import javax.media.opengl.GLContext;
-import static com.jogamp.opencl.CL.*;
+import static com.jogamp.opencl.llb.CL.*;
/**
* 3D OpenCL image representing an 3D OpenGL texture.
@@ -66,7 +67,7 @@ public class CLGLTexture3d<B extends Buffer> extends CLImage3d<B> implements CLG
CL cl = getCL(context);
int[] result = new int[1];
- CLGLI clgli = (CLGLI)cl;
+ CLGL clgli = (CLGL)cl;
long id = clgli.clCreateFromGLTexture3D(context.ID, flags, target, mipLevel, texture, result, 0);
@@ -82,18 +83,22 @@ public class CLGLTexture3d<B extends Buffer> extends CLImage3d<B> implements CLG
return new CLGLTexture3d<B>(context, directBuffer, format, accessor, target, mipLevel, width, height, depth, id, texture, flags);
}
+ @Override
public int getGLObjectID() {
return GLID;
}
+ @Override
public int getTextureTarget() {
return target;
}
+ @Override
public int getMipMapLevel() {
return mipMapLevel;
}
+ @Override
public GLObjectType getGLObjectType() {
return GLObjectType.GL_OBJECT_TEXTURE3D;
}
diff --git a/src/com/jogamp/opencl/gl/package.html b/src/com/jogamp/opencl/gl/package.html
new file mode 100644
index 00000000..24ad0c2e
--- /dev/null
+++ b/src/com/jogamp/opencl/gl/package.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+ <body>
+ High level java bindings, OpenCL-OpenGL interoperability.
+ </body>
+</html>
diff --git a/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java b/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java
index 2f34fec5..36718f1a 100644
--- a/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java
+++ b/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java
@@ -5,7 +5,8 @@ package com.jogamp.opencl.impl;
import java.nio.IntBuffer;
import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.opencl.CL;
+import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.llb.CLDeviceBinding;
import com.jogamp.opencl.spi.CLAccessorFactory;
import com.jogamp.opencl.spi.CLInfoAccessor;
import com.jogamp.opencl.spi.CLPlatformInfoAccessor;
@@ -20,7 +21,7 @@ import static com.jogamp.opencl.CLException.*;
public class CLTLAccessorFactory implements CLAccessorFactory {
@Override
- public CLInfoAccessor createDeviceInfoAccessor(CL cl, long id) {
+ public CLInfoAccessor createDeviceInfoAccessor(CLDeviceBinding cl, long id) {
return new CLDeviceInfoAccessor(cl, id);
}
@@ -31,10 +32,10 @@ public class CLTLAccessorFactory implements CLAccessorFactory {
private final static class CLDeviceInfoAccessor extends CLTLInfoAccessor {
- private final CL cl;
+ private final CLDeviceBinding cl;
private final long ID;
- private CLDeviceInfoAccessor(CL cl, long id) {
+ private CLDeviceInfoAccessor(CLDeviceBinding cl, long id) {
this.cl = cl;
this.ID = id;
}
diff --git a/src/com/jogamp/opencl/llb/gl/package.html b/src/com/jogamp/opencl/llb/gl/package.html
new file mode 100644
index 00000000..47cec148
--- /dev/null
+++ b/src/com/jogamp/opencl/llb/gl/package.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+ <body>
+ Low level java bindings, OpenCL-OpenGL interoperability.
+ </body>
+</html>
diff --git a/src/com/jogamp/opencl/impl/BuildProgramCallback.java b/src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java
index cb4b36d1..51bde322 100644
--- a/src/com/jogamp/opencl/impl/BuildProgramCallback.java
+++ b/src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java
@@ -26,15 +26,15 @@
* or implied, of JogAmp Community.
*/
-package com.jogamp.opencl.impl;
+package com.jogamp.opencl.llb.impl;
/**
* A callback an application can register to be called when the program executable
* has been built (successfully or unsuccessfully).<br/>
- * Note1: registering a build callback can make {@link com.jogamp.opencl.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/>
- * Note2: the thread which calls this method is unspecified. The Application should ensure propper synchronization.
+ * Note1: registering a build callback can make {@link com.jogamp.opencl.llb.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/>
+ * Note2: the thread which calls this method is unspecified. The Application should ensure proper synchronization.
* @author Michael Bien
- * @see com.jogamp.opencl.CL#clBuildProgram(long, int, com.jogamp.common.nio.PointerBuffer, java.lang.String, com.jogamp.opencl.impl.BuildProgramCallback)
+ * @see com.jogamp.opencl.llb.CL#clBuildProgram
*/
public interface BuildProgramCallback {
diff --git a/src/com/jogamp/opencl/impl/CLEventCallback.java b/src/com/jogamp/opencl/llb/impl/CLEventCallback.java
index d1526a08..1373995a 100644
--- a/src/com/jogamp/opencl/impl/CLEventCallback.java
+++ b/src/com/jogamp/opencl/llb/impl/CLEventCallback.java
@@ -30,7 +30,7 @@
* Created on Tuesday, July 06 2010 00:46
*/
-package com.jogamp.opencl.impl;
+package com.jogamp.opencl.llb.impl;
/**
* A callback for a specific command execution status.
diff --git a/src/com/jogamp/opencl/impl/CLImpl.java b/src/com/jogamp/opencl/llb/impl/CLImpl.java
index e7f034af..0713ac4d 100644
--- a/src/com/jogamp/opencl/impl/CLImpl.java
+++ b/src/com/jogamp/opencl/llb/impl/CLImpl.java
@@ -29,7 +29,7 @@
/*
* Created on Monday, June 07 2010 at 04:25
*/
-package com.jogamp.opencl.impl;
+package com.jogamp.opencl.llb.impl;
import com.jogamp.common.nio.PointerBuffer;
import com.jogamp.common.os.Platform;
@@ -56,6 +56,7 @@ public class CLImpl extends CLAbstractImpl {
this.contextCallbackMap.setKeyNotFoundValue(0);
}
+ @Override
public long clCreateContext(PointerBuffer properties, PointerBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret) {
if (properties != null && !properties.isDirect()) {
@@ -87,8 +88,8 @@ public class CLImpl extends CLAbstractImpl {
private native long clCreateContext0(Object cl_context_properties, int props_offset, int numDevices, Object devices, int devices_offset, Object pfn_notify, long[] global, Object errcode_ret, int err_offset, long address);
+ @Override
public long clCreateContextFromType(PointerBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret) {
-
if (properties != null && !properties.isDirect()) {
throw new RuntimeException("Argument \"properties\" was not a direct buffer");
}
@@ -117,6 +118,7 @@ public class CLImpl extends CLAbstractImpl {
private native long clCreateContextFromType0(Object properties, int props_offset, long device_type, Object pfn_notify, long[] global, Object errcode_ret, int err_offset, long address);
+ @Override
public int clReleaseContext(long context) {
long global = 0;
synchronized (contextCallbackMap) {
@@ -134,8 +136,8 @@ public class CLImpl extends CLAbstractImpl {
public native int clReleaseContextImpl(long context, long global, long address);
/** Interface to C language function: <br> <code> int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); </code> */
+ @Override
public int clBuildProgram(long program, int deviceCount, PointerBuffer deviceList, String options, BuildProgramCallback cb) {
-
if (deviceList != null && !deviceList.isDirect()) {
throw new RuntimeException("Argument \"properties\" was not a direct buffer");
}
@@ -152,6 +154,7 @@ public class CLImpl extends CLAbstractImpl {
private native int clBuildProgram0(long program, int deviceCount, Object deviceList, int deviceListOffset, String options, BuildProgramCallback cb, long address);
+ @Override
public int clSetEventCallback(long event, int trigger, CLEventCallback callback) {
final long address = addressTable._addressof_clSetEventCallback;
if (address == 0) {
@@ -163,6 +166,7 @@ public class CLImpl extends CLAbstractImpl {
private native int clSetEventCallback0(long event, int type, CLEventCallback cb, long address);
+ @Override
public int clSetMemObjectDestructorCallback(long memObjID, CLMemObjectDestructorCallback cb) {
final long address = addressTable._addressof_clSetMemObjectDestructorCallback;
if (address == 0) {
@@ -175,13 +179,14 @@ public class CLImpl extends CLAbstractImpl {
/** Interface to C language function: <br> <code> void * {@native clEnqueueMapImage}(cl_command_queue command_queue, cl_mem image, uint32_t blocking_map, uint64_t map_flags, const size_t * , const size_t * , size_t * image_row_pitch, size_t * image_slice_pitch, uint32_t num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, int32_t * errcode_ret); </code>
- @param origin a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param range a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param event a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
+ @param origin a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param range a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param image_row_pitch a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param image_slice_pitch a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param event_wait_list a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param event a direct {@link com.jogamp.common.nio.PointerBuffer}
@param errcode_ret a direct {@link java.nio.IntBuffer} */
+ @Override
public ByteBuffer clEnqueueMapImage(long command_queue, long image, int blocking_map, long map_flags,
PointerBuffer origin, PointerBuffer range,
PointerBuffer image_row_pitch, PointerBuffer image_slice_pitch,
@@ -235,12 +240,12 @@ public class CLImpl extends CLAbstractImpl {
}
/** Entry point to C language function: <code> void * {@native clEnqueueMapImage}(cl_command_queue command_queue, cl_mem image, uint32_t blocking_map, uint64_t map_flags, const size_t * , const size_t * , size_t * image_row_pitch, size_t * image_slice_pitch, uint32_t num_events_in_wait_list, cl_event * event_wait_list, cl_event * event, int32_t * errcode_ret); </code>
- @param origin a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param range a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
- @param event a direct {@link com.jogamp.gluegen.common.nio.PointerBuffer}
+ @param origin a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param range a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param image_row_pitch a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param image_slice_pitch a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param event_wait_list a direct {@link com.jogamp.common.nio.PointerBuffer}
+ @param event a direct {@link com.jogamp.common.nio.PointerBuffer}
@param errcode_ret a direct {@link java.nio.IntBuffer} */
private native ByteBuffer clEnqueueMapImage0(long command_queue, long image, int blocking_map, long map_flags,
Object origin, int origin_byte_offset, Object range, int range_byte_offset, Object image_row_pitch,
diff --git a/src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java b/src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java
index c040d2ce..5ed57cce 100644
--- a/src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java
+++ b/src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java
@@ -30,7 +30,7 @@
* Created on Thursday, September 02 2010 23:09
*/
-package com.jogamp.opencl.impl;
+package com.jogamp.opencl.llb.impl;
/**
* A callback which is invoked by the OpenCL implementation when the memory
diff --git a/src/com/jogamp/opencl/llb/package.html b/src/com/jogamp/opencl/llb/package.html
new file mode 100644
index 00000000..b68c4de7
--- /dev/null
+++ b/src/com/jogamp/opencl/llb/package.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+ <body>
+ Low level java bindings to OpenCL.
+ </body>
+</html>
diff --git a/src/com/jogamp/opencl/package.html b/src/com/jogamp/opencl/package.html
new file mode 100644
index 00000000..c7cc0a33
--- /dev/null
+++ b/src/com/jogamp/opencl/package.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+ <body>
+ High level java bindings to OpenCL.
+ </body>
+</html>
diff --git a/src/com/jogamp/opencl/spi/CLAccessorFactory.java b/src/com/jogamp/opencl/spi/CLAccessorFactory.java
index 6239bb37..4bafe933 100644
--- a/src/com/jogamp/opencl/spi/CLAccessorFactory.java
+++ b/src/com/jogamp/opencl/spi/CLAccessorFactory.java
@@ -3,7 +3,8 @@
*/
package com.jogamp.opencl.spi;
-import com.jogamp.opencl.CL;
+import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.llb.CLDeviceBinding;
/**
* Implementations of this interface are factories responsible for creating CLAccessors.
@@ -11,7 +12,7 @@ import com.jogamp.opencl.CL;
*/
public interface CLAccessorFactory {
- CLInfoAccessor createDeviceInfoAccessor(CL cl, long id);
+ CLInfoAccessor createDeviceInfoAccessor(CLDeviceBinding cl, long id);
CLPlatformInfoAccessor createPlatformInfoAccessor(CL cl, long id);
diff --git a/src/com/jogamp/opencl/spi/package.html b/src/com/jogamp/opencl/spi/package.html
new file mode 100644
index 00000000..436d5d2b
--- /dev/null
+++ b/src/com/jogamp/opencl/spi/package.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+ <body>
+ SPI for alternative binding implementations.
+ </body>
+</html>
diff --git a/src/com/jogamp/opencl/util/CLBuildListener.java b/src/com/jogamp/opencl/util/CLBuildListener.java
index cec4d391..acd53a52 100644
--- a/src/com/jogamp/opencl/util/CLBuildListener.java
+++ b/src/com/jogamp/opencl/util/CLBuildListener.java
@@ -37,10 +37,10 @@ import com.jogamp.opencl.CLProgram;
/**
* A callback an application can register to be called when the program executable
* has been built (successfully or unsuccessfully).<br/>
- * Note1: registering a build callback can make {@link com.jogamp.opencl.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/>
+ * Note1: registering a build callback can make {@link com.jogamp.opencl.llb.CL#clBuildProgram} non blocking (OpenCL implementation dependent).<br/>
* Note2: the thread which calls this method is unspecified. The Application should ensure propper synchronization.
* @author Michael Bien
- * @see com.jogamp.opencl.CL#clBuildProgram(long, int, com.jogamp.common.nio.PointerBuffer, java.lang.String, com.jogamp.opencl.impl.BuildProgramCallback)
+ * @see com.jogamp.opencl.llb.CL#clBuildProgram(long, int, com.jogamp.common.nio.PointerBuffer, java.lang.String, com.jogamp.opencl.llb.impl.BuildProgramCallback)
*/
public interface CLBuildListener {
diff --git a/src/com/jogamp/opencl/util/CLDeviceFilters.java b/src/com/jogamp/opencl/util/CLDeviceFilters.java
index 045d4c7f..a5057fb6 100644
--- a/src/com/jogamp/opencl/util/CLDeviceFilters.java
+++ b/src/com/jogamp/opencl/util/CLDeviceFilters.java
@@ -32,6 +32,7 @@ import com.jogamp.opencl.CLCommandQueue.Mode;
import com.jogamp.opencl.CLDevice;
import java.nio.ByteOrder;
import java.util.Arrays;
+import java.util.EnumSet;
import java.util.List;
/**
@@ -45,13 +46,14 @@ public class CLDeviceFilters {
/**
* Accepts all devices of the given type.
*/
- public static Filter<CLDevice> type(final CLDevice.Type type) {
+ public static Filter<CLDevice> type(final CLDevice.Type... types) {
return new Filter<CLDevice>() {
+ private final EnumSet<CLDevice.Type> set = EnumSet.copyOf(Arrays.asList(types));
public boolean accept(CLDevice item) {
- if(type.equals(CLDevice.Type.ALL)) {
+ if(set.contains(CLDevice.Type.ALL)) {
return true;
}
- return item.getType().equals(type);
+ return set.contains(item.getType());
}
};
}
diff --git a/src/com/jogamp/opencl/util/CLInfo.java b/src/com/jogamp/opencl/util/CLInfo.java
index 3b483fc2..40c4f2ff 100644
--- a/src/com/jogamp/opencl/util/CLInfo.java
+++ b/src/com/jogamp/opencl/util/CLInfo.java
@@ -34,7 +34,7 @@ package com.jogamp.opencl.util;
import com.jogamp.common.os.Platform;
import com.jogamp.opencl.CLDevice;
import com.jogamp.opencl.CLPlatform;
-import com.jogamp.opencl.impl.CLImpl;
+import com.jogamp.opencl.llb.impl.CLImpl;
import java.util.Map;
diff --git a/src/com/jogamp/opencl/util/CLMultiContext.java b/src/com/jogamp/opencl/util/CLMultiContext.java
index f74c0a35..156a9fa6 100644
--- a/src/com/jogamp/opencl/util/CLMultiContext.java
+++ b/src/com/jogamp/opencl/util/CLMultiContext.java
@@ -25,6 +25,7 @@ import static com.jogamp.opencl.CLDevice.Type.*;
public class CLMultiContext implements CLResource {
private final List<CLContext> contexts;
+ private boolean released;
private CLMultiContext() {
contexts = new ArrayList<CLContext>();
@@ -41,7 +42,14 @@ public class CLMultiContext implements CLResource {
* Creates a multi context with all devices of the specified platforms and types.
*/
public static CLMultiContext create(CLPlatform[] platforms, CLDevice.Type... types) {
-
+ return create(platforms, CLDeviceFilters.type(types));
+ }
+
+ /**
+ * Creates a multi context with all matching devices of the specified platforms.
+ */
+ public static CLMultiContext create(CLPlatform[] platforms, Filter<CLDevice>... filters) {
+
if(platforms == null) {
throw new NullPointerException("platform list was null");
}else if(platforms.length == 0) {
@@ -50,7 +58,7 @@ public class CLMultiContext implements CLResource {
List<CLDevice> devices = new ArrayList<CLDevice>();
for (CLPlatform platform : platforms) {
- devices.addAll(asList(platform.listCLDevices(types)));
+ devices.addAll(asList(platform.listCLDevices(filters)));
}
return create(devices);
}
@@ -125,7 +133,12 @@ public class CLMultiContext implements CLResource {
* Releases all contexts.
* @see CLContext#release()
*/
+ @Override
public void release() {
+ if(released) {
+ throw new RuntimeException(getClass().getSimpleName()+" already released");
+ }
+ released = true;
for (CLContext context : contexts) {
context.release();
}
@@ -147,6 +160,10 @@ public class CLMultiContext implements CLResource {
return devices;
}
+ public boolean isReleased() {
+ return released;
+ }
+
@Override
public String toString() {
return getClass().getSimpleName()+" [" + contexts.size()+" contexts, "
diff --git a/src/com/jogamp/opencl/util/CLUtil.java b/src/com/jogamp/opencl/util/CLUtil.java
index 371c493c..98a6cd7e 100644
--- a/src/com/jogamp/opencl/util/CLUtil.java
+++ b/src/com/jogamp/opencl/util/CLUtil.java
@@ -29,7 +29,7 @@
package com.jogamp.opencl.util;
import com.jogamp.common.JogampRuntimeException;
-import com.jogamp.opencl.CL;
+import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.CLDevice;
import com.jogamp.opencl.CLPlatform;
import com.jogamp.opencl.CLProperty;
diff --git a/src/com/jogamp/opencl/util/JOCLVersion.java b/src/com/jogamp/opencl/util/JOCLVersion.java
index 265233a2..48dd2a9e 100644
--- a/src/com/jogamp/opencl/util/JOCLVersion.java
+++ b/src/com/jogamp/opencl/util/JOCLVersion.java
@@ -35,7 +35,7 @@ import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.JogampVersion;
import com.jogamp.common.util.VersionUtil;
-import com.jogamp.opencl.CL;
+import com.jogamp.opencl.llb.CL;
import java.security.PrivilegedAction;
import java.util.jar.Manifest;
@@ -56,7 +56,7 @@ public class JOCLVersion extends JogampVersion {
private static JOCLVersion createInstance() {
return doPrivileged(new PrivilegedAction<JOCLVersion>() {
- public JOCLVersion run() {
+ @Override public JOCLVersion run() {
Manifest manifest = VersionUtil.getManifest(CL.class.getClassLoader(), PACKAGE);
if(manifest == null) {
manifest = new Manifest();
@@ -92,7 +92,7 @@ public class JOCLVersion extends JogampVersion {
try{
doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
+ @Override public Object run() {
sb.append(GlueGenVersion.getInstance().toString());
return null;
}
diff --git a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
index 9ea960ae..e8bd0124 100644
--- a/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
+++ b/src/com/jogamp/opencl/util/concurrent/CLCommandQueuePool.java
@@ -29,6 +29,7 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
private List<CLQueueContext> contexts;
private ExecutorService excecutor;
private FinishAction finishAction = FinishAction.DO_NOTHING;
+ private boolean released;
private CLCommandQueuePool(CLQueueContextFactory factory, Collection<CLCommandQueue> queues) {
this.contexts = initContexts(queues, factory);
@@ -157,7 +158,12 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
/**
* Releases all queues.
*/
+ @Override
public void release() {
+ if(released) {
+ throw new RuntimeException(getClass().getSimpleName()+" already released");
+ }
+ released = true;
excecutor.shutdown();
for (CLQueueContext context : contexts) {
context.queue.finish().release();
@@ -187,6 +193,11 @@ public class CLCommandQueuePool<C extends CLQueueContext> implements CLResource
return finishAction;
}
+ @Override
+ public boolean isReleased() {
+ return released;
+ }
+
/**
* Sets the action which is run after every completed task.
* This is mainly intended for debugging, default value is {@link FinishAction#DO_NOTHING}.
diff --git a/src/com/jogamp/opencl/util/concurrent/CLQueueContext.java b/src/com/jogamp/opencl/util/concurrent/CLQueueContext.java
index 3f89ad0e..9f92b9a3 100644
--- a/src/com/jogamp/opencl/util/concurrent/CLQueueContext.java
+++ b/src/com/jogamp/opencl/util/concurrent/CLQueueContext.java
@@ -63,10 +63,16 @@ public abstract class CLQueueContext implements CLResource {
return program;
}
+ @Override
public void release() {
program.release();
}
+ @Override
+ public boolean isReleased() {
+ return program.isReleased();
+ }
+
}
}
diff --git a/src/com/jogamp/opencl/util/concurrent/package.html b/src/com/jogamp/opencl/util/concurrent/package.html
new file mode 100644
index 00000000..8b9dc9eb
--- /dev/null
+++ b/src/com/jogamp/opencl/util/concurrent/package.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+ <body>
+ OpenCL multi device concurrency utilities.
+ </body>
+</html>
diff --git a/src/com/jogamp/opencl/util/package.html b/src/com/jogamp/opencl/util/package.html
new file mode 100644
index 00000000..1408c02b
--- /dev/null
+++ b/src/com/jogamp/opencl/util/package.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <head></head>
+ <body>
+ OpenCL utilities.
+ </body>
+</html>
diff --git a/src/overview.html b/src/overview.html
new file mode 100644
index 00000000..468247ef
--- /dev/null
+++ b/src/overview.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ Java bindings to OpenCL (JOCL).
+ </body>
+</html>
diff --git a/test/com/jogamp/opencl/CLCommandQueueTest.java b/test/com/jogamp/opencl/CLCommandQueueTest.java
index 5636a40d..f5438d40 100644
--- a/test/com/jogamp/opencl/CLCommandQueueTest.java
+++ b/test/com/jogamp/opencl/CLCommandQueueTest.java
@@ -37,6 +37,7 @@ import com.jogamp.opencl.CLCommandQueue.Mode;
import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.util.CLDeviceFilters;
import com.jogamp.opencl.util.CLPlatformFilters;
+import com.jogamp.opencl.llb.CL;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java
index a3ee26f3..d083c770 100644
--- a/test/com/jogamp/opencl/CLProgramTest.java
+++ b/test/com/jogamp/opencl/CLProgramTest.java
@@ -32,6 +32,7 @@ import com.jogamp.opencl.util.CLBuildConfiguration;
import com.jogamp.opencl.util.CLProgramConfiguration;
import com.jogamp.opencl.CLProgram.Status;
import com.jogamp.opencl.util.CLBuildListener;
+import com.jogamp.opencl.llb.CL;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -221,6 +222,7 @@ public class CLProgramTest {
final CLProgram outerProgram = program;
CLBuildListener buildCallback = new CLBuildListener() {
+ @Override
public void buildFinished(CLProgram program) {
assertEquals(outerProgram, program);
countdown.countDown();
@@ -268,7 +270,7 @@ public class CLProgramTest {
@Test
public void kernelTest() {
- String source = "__attribute__((reqd_work_group_size(1, 1, 1))) kernel void foo(float a, int b) { }\n";
+ String source = "__attribute__((reqd_work_group_size(1, 1, 1))) kernel void foo(float a, int b, short c) { }\n";
CLContext context = CLContext.create();
@@ -295,13 +297,16 @@ public class CLProgramTest {
kernel.putArg(2);
assertEquals(2, kernel.position());
+
+ kernel.putArg((short)3);
+ assertEquals(3, kernel.position());
try{
kernel.putArg(3);
fail("exception not thrown");
}catch (IndexOutOfBoundsException expected){ }
- assertEquals(2, kernel.position());
+ assertEquals(3, kernel.position());
assertEquals(0, kernel.rewind().position());
}finally{
diff --git a/test/com/jogamp/opencl/HighLevelBindingTest.java b/test/com/jogamp/opencl/HighLevelBindingTest.java
index 749db3a6..fe6bef51 100644
--- a/test/com/jogamp/opencl/HighLevelBindingTest.java
+++ b/test/com/jogamp/opencl/HighLevelBindingTest.java
@@ -39,6 +39,7 @@ import com.jogamp.opencl.CLDevice.GlobalMemCacheType;
import com.jogamp.opencl.CLDevice.LocalMemType;
import com.jogamp.opencl.CLDevice.Type;
import com.jogamp.opencl.CLDevice.Capabilities;
+import com.jogamp.opencl.llb.CL;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
diff --git a/test/com/jogamp/opencl/LowLevelBindingTest.java b/test/com/jogamp/opencl/LowLevelBindingTest.java
index 43e3b931..c8e27a60 100644
--- a/test/com/jogamp/opencl/LowLevelBindingTest.java
+++ b/test/com/jogamp/opencl/LowLevelBindingTest.java
@@ -29,8 +29,9 @@
package com.jogamp.opencl;
import java.util.Random;
-import com.jogamp.opencl.impl.BuildProgramCallback;
import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.opencl.llb.impl.BuildProgramCallback;
+import com.jogamp.opencl.llb.CL;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
@@ -292,6 +293,7 @@ public class LowLevelBindingTest {
// tests if the callback is called
final CountDownLatch latch = new CountDownLatch(1);
BuildProgramCallback callback = new BuildProgramCallback() {
+ @Override
public void buildFinished(long cl_program) {
try{
assertEquals(program, cl_program);
@@ -421,6 +423,7 @@ public class LowLevelBindingTest {
for(int i = 0; i < 100; i++) {
final int n = i;
tasks.add(new Callable<Object>() {
+ @Override
public Object call() {
try {
out.println("###start iteration " + n);