From a444a384b808e423f2e8377ff14c69b0c4be043a Mon Sep 17 00:00:00 2001 From: Michael Bien Date: Fri, 27 May 2011 03:00:12 +0200 Subject: LLB refactoring. - split up CL into multiple sub interfaces - seperation is now feature wise - introdused llb package for low level classes --- build.xml | 118 ++++++++- resources/cl-buffer-if.cfg | 13 + resources/cl-common.cfg | 4 +- resources/cl-context-if.cfg | 23 ++ resources/cl-device-if.cfg | 12 + resources/cl-event-if.cfg | 17 ++ resources/cl-if.cfg | 60 ++--- resources/cl-image-if.cfg | 16 ++ resources/cl-impl.cfg | 6 +- resources/cl-kernel-if.cfg | 12 + resources/cl-mem-if.cfg | 18 ++ resources/cl-platform-if.cfg | 12 + resources/cl-program-if.cfg | 18 ++ resources/cl-queue-if.cfg | 12 + resources/cl-sampler-if.cfg | 12 + resources/clImplCustomCode.c | 20 +- resources/clgl-if.cfg | 20 +- src/com/jogamp/opencl/CLBuffer.java | 1 + src/com/jogamp/opencl/CLCommandQueue.java | 8 +- src/com/jogamp/opencl/CLContext.java | 11 +- src/com/jogamp/opencl/CLDevice.java | 3 +- src/com/jogamp/opencl/CLEvent.java | 4 +- src/com/jogamp/opencl/CLEventList.java | 6 + src/com/jogamp/opencl/CLException.java | 2 +- src/com/jogamp/opencl/CLImage.java | 3 +- src/com/jogamp/opencl/CLImage2d.java | 1 + src/com/jogamp/opencl/CLImage3d.java | 3 +- src/com/jogamp/opencl/CLImageFormat.java | 4 +- src/com/jogamp/opencl/CLKernel.java | 5 +- src/com/jogamp/opencl/CLMemory.java | 11 +- src/com/jogamp/opencl/CLObject.java | 2 + src/com/jogamp/opencl/CLPlatform.java | 7 +- src/com/jogamp/opencl/CLProgram.java | 4 +- src/com/jogamp/opencl/CLSampler.java | 4 +- src/com/jogamp/opencl/CLUserEvent.java | 2 +- src/com/jogamp/opencl/gl/CLGLBuffer.java | 6 +- src/com/jogamp/opencl/gl/CLGLContext.java | 7 +- src/com/jogamp/opencl/gl/CLGLImage2d.java | 10 +- src/com/jogamp/opencl/gl/CLGLTexture2d.java | 17 +- src/com/jogamp/opencl/gl/CLGLTexture3d.java | 13 +- .../jogamp/opencl/impl/BuildProgramCallback.java | 47 ---- src/com/jogamp/opencl/impl/CLEventCallback.java | 43 --- src/com/jogamp/opencl/impl/CLImpl.java | 284 -------------------- .../opencl/impl/CLMemObjectDestructorCallback.java | 47 ---- .../jogamp/opencl/impl/CLTLAccessorFactory.java | 2 +- .../opencl/llb/impl/BuildProgramCallback.java | 47 ++++ .../jogamp/opencl/llb/impl/CLEventCallback.java | 43 +++ src/com/jogamp/opencl/llb/impl/CLImpl.java | 291 +++++++++++++++++++++ .../llb/impl/CLMemObjectDestructorCallback.java | 47 ++++ src/com/jogamp/opencl/spi/CLAccessorFactory.java | 2 +- src/com/jogamp/opencl/util/CLBuildListener.java | 4 +- src/com/jogamp/opencl/util/CLInfo.java | 2 +- src/com/jogamp/opencl/util/CLUtil.java | 2 +- src/com/jogamp/opencl/util/JOCLVersion.java | 6 +- test/com/jogamp/opencl/CLCommandQueueTest.java | 1 + test/com/jogamp/opencl/CLProgramTest.java | 2 + test/com/jogamp/opencl/HighLevelBindingTest.java | 1 + test/com/jogamp/opencl/LowLevelBindingTest.java | 5 +- 58 files changed, 860 insertions(+), 543 deletions(-) create mode 100644 resources/cl-buffer-if.cfg create mode 100644 resources/cl-context-if.cfg create mode 100644 resources/cl-device-if.cfg create mode 100644 resources/cl-event-if.cfg create mode 100644 resources/cl-image-if.cfg create mode 100644 resources/cl-kernel-if.cfg create mode 100644 resources/cl-mem-if.cfg create mode 100644 resources/cl-platform-if.cfg create mode 100644 resources/cl-program-if.cfg create mode 100644 resources/cl-queue-if.cfg create mode 100644 resources/cl-sampler-if.cfg delete mode 100644 src/com/jogamp/opencl/impl/BuildProgramCallback.java delete mode 100644 src/com/jogamp/opencl/impl/CLEventCallback.java delete mode 100644 src/com/jogamp/opencl/impl/CLImpl.java delete mode 100644 src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java create mode 100644 src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java create mode 100644 src/com/jogamp/opencl/llb/impl/CLEventCallback.java create mode 100644 src/com/jogamp/opencl/llb/impl/CLImpl.java create mode 100644 src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java diff --git a/build.xml b/build.xml index b1a1234f..4c11fc97 100644 --- a/build.xml +++ b/build.xml @@ -93,7 +93,119 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + cl_context {@native clCreateContext}(intptr_t * , uint32_t, cl_device_id * , void (*pfn_notify)(const char *, const void *, size_t, void *), void *, int32_t * ); */ +CustomJavaCode CLContext public long clCreateContext(NativeSizeBuffer properties, NativeSizeBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret); + +CustomJavaCode CLContext +CustomJavaCode CLContext /** Interface to C language function:
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) ; */ +CustomJavaCode CLContext public long clCreateContextFromType(NativeSizeBuffer 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..fe09a343 --- /dev/null +++ b/resources/cl-device-if.cfg @@ -0,0 +1,12 @@ +Include cl-common.cfg + +Style InterfaceOnly + +ClassJavadoc CLDevice /** +ClassJavadoc CLDevice * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLDevice * @author Michael Bien +ClassJavadoc CLDevice */ +JavaClass CLDevice + +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..5d24302f --- /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 CLEvent /** +ClassJavadoc CLEvent * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLEvent * @author Michael Bien +ClassJavadoc CLEvent */ +JavaClass CLEvent + +IgnoreNot .*CreateUserEvent.*|.*GetEventInfo.*|.*GetEventProfilingInfo.*|.*SetUserEventStatus.*|clWaitForEvents.*|.*RetainEvent.*|.*ReleaseEvent.*|CL_EVENT_.* + +CustomJavaCode CLEvent +CustomJavaCode CLEvent /** Interface to C language function:
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); */ +CustomJavaCode CLEvent 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 aa7de799..2b08e86a 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 CLContext +Extends CL CLProgram +Extends CL CLKernel +Extends CL CLCommandQueue +Extends CL CLDevice +Extends CL CLImage +Extends CL CLBuffer +Extends CL CLSampler +Extends CL CLEvent +Extends CL CLPlatform + +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLContext.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLProgram.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLKernel.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLCommandQueue.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLDevice.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLMemObj.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLImage.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLBuffer.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLSampler.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLEvent.java +ExtendedInterfaceSymbolsIgnore gensrc/java/com/jogamp/opencl/llb/CLPlatform.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:
cl_context {@native clCreateContext}(intptr_t * , uint32_t, cl_device_id * , void (*pfn_notify)(const char *, const void *, size_t, void *), void *, int32_t * ); */ -CustomJavaCode CL public long clCreateContext(NativeSizeBuffer properties, NativeSizeBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret); - Ignore clCreateContextFromType -CustomJavaCode CL -CustomJavaCode CL /** Interface to C language function:
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) ; */ -CustomJavaCode CL public long clCreateContextFromType(NativeSizeBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret); - Ignore clBuildProgram -CustomJavaCode CL -CustomJavaCode CL /** Interface to C language function:
int32_t {@native clBuildProgram}(cl_program, uint32_t, cl_device_id * , const char * , void (*pfn_notify)(cl_program, void *user_data), void * ); */ -CustomJavaCode CL public int clBuildProgram(long program, int deviceCount, NativeSizeBuffer devices, String options, BuildProgramCallback cb); - +Ignore clEnqueueNativeKernel Ignore clSetEventCallback -CustomJavaCode CL -CustomJavaCode CL /** Interface to C language function:
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); */ -CustomJavaCode CL public int clSetEventCallback(long event, int type, CLEventCallback cb); - Ignore clSetMemObjectDestructorCallback -CustomJavaCode CL -CustomJavaCode CL /** Interface to C language function:
int32_t {@native clSetMemObjectDestructorCallback}(cl_mem memobj, void (CL_CALLBACK *pfn_notify) (cl_mem memobj, void *user_data), void *user_data); */ -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..39814f23 --- /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 CLImage /** +ClassJavadoc CLImage * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLImage * @author Michael Bien +ClassJavadoc CLImage */ +JavaClass CLImage + +Extends CLImage CLMemObj + +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..930160cb --- /dev/null +++ b/resources/cl-kernel-if.cfg @@ -0,0 +1,12 @@ +Include cl-common.cfg + +Style InterfaceOnly + +ClassJavadoc CLKernel /** +ClassJavadoc CLKernel * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLKernel * @author Michael Bien +ClassJavadoc CLKernel */ +JavaClass CLKernel + +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..6efc344d --- /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 CLMemObj /** +ClassJavadoc CLMemObj * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLMemObj * @author Michael Bien +ClassJavadoc CLMemObj */ +JavaClass CLMemObj + +IgnoreNot .*GetMemObjectInfo.*|.*RetainMemObject.*|.*ReleaseMemObject.*|CL_MEM_.*|CL_MAP_.* + +CustomJavaCode CLMemObj +CustomJavaCode CLMemObj /** Interface to C language function:
int32_t {@native clSetMemObjectDestructorCallback}(cl_mem memobj, void (CL_CALLBACK *pfn_notify) (cl_mem memobj, void *user_data), void *user_data); */ +CustomJavaCode CLMemObj 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..a6a3e763 --- /dev/null +++ b/resources/cl-platform-if.cfg @@ -0,0 +1,12 @@ +Include cl-common.cfg + +Style InterfaceOnly + +ClassJavadoc CLPlatform /** +ClassJavadoc CLPlatform * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLPlatform * @author Michael Bien +ClassJavadoc CLPlatform */ +JavaClass CLPlatform + +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..109430ca --- /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 CLProgram /** +ClassJavadoc CLProgram * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLProgram * @author Michael Bien +ClassJavadoc CLProgram */ +JavaClass CLProgram + +IgnoreNot .*CreateProgramWith.*|.*Program.*Info.*|.*RetainProgram.*|.*ReleaseProgram.*|CL_PROGRAM_.*|CL_BUILD_.* + +#custom implementations +CustomJavaCode CLProgram +CustomJavaCode CLProgram /** Interface to C language function:
int32_t {@native clBuildProgram}(cl_program, uint32_t, cl_device_id * , const char * , void (*pfn_notify)(cl_program, void *user_data), void * ); */ +CustomJavaCode CLProgram public int clBuildProgram(long program, int deviceCount, NativeSizeBuffer 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..5576709d --- /dev/null +++ b/resources/cl-queue-if.cfg @@ -0,0 +1,12 @@ +Include cl-common.cfg + +Style InterfaceOnly + +ClassJavadoc CLCommandQueue /** +ClassJavadoc CLCommandQueue * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLCommandQueue * @author Michael Bien +ClassJavadoc CLCommandQueue */ +JavaClass CLCommandQueue + +IgnoreNot .*CreateCommandQueue.*|.*GetCommandQueueInfo.*|.*EnqueueRead.*|.*EnqueueWrite.*|.*EnqueueCopy.*|.*EnqueueMap.*|.*EnqueueUnmap.*|.*EnqueueBarrier.*|.*EnqueueNDRange.*|.*EnqueueTask.*|.*EnqueueMarker.*|.*EnqueueWait.*|.*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..3b705c59 --- /dev/null +++ b/resources/cl-sampler-if.cfg @@ -0,0 +1,12 @@ +Include cl-common.cfg + +Style InterfaceOnly + +ClassJavadoc CLSampler /** +ClassJavadoc CLSampler * Java bindings to OpenCL, the Open Computing Language. +ClassJavadoc CLSampler * @author Michael Bien +ClassJavadoc CLSampler */ +JavaClass CLSampler + +IgnoreNot .*CreateSampler.*|.*GetSamplerInfo.*|.*RetainSampler.*|.*ReleaseSampler.*|CL_SAMPLER_.*|CL_ADDRESS_.*|CL_FILTER_.* + diff --git a/resources/clImplCustomCode.c b/resources/clImplCustomCode.c index 789491c6..fba3cb3d 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 diff --git a/src/com/jogamp/opencl/CLBuffer.java b/src/com/jogamp/opencl/CLBuffer.java index 6f00247c..dfdfd2d0 100644 --- a/src/com/jogamp/opencl/CLBuffer.java +++ b/src/com/jogamp/opencl/CLBuffer.java @@ -32,6 +32,7 @@ import com.jogamp.common.nio.Buffers; import java.util.List; import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.opencl.CLMemory.Mem; +import com.jogamp.opencl.llb.CL; import java.nio.Buffer; import java.util.ArrayList; import java.util.Collections; diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index d578738b..2f83464f 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -29,7 +29,7 @@ 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.NativeSizeBuffer; import com.jogamp.opencl.gl.CLGLObject; import java.nio.Buffer; @@ -41,7 +41,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.*; /** @@ -1667,7 +1667,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, @@ -1736,7 +1736,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, diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index 147fc2ae..2beea3f8 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -28,12 +28,13 @@ 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.NativeSizeBuffer; -import com.jogamp.opencl.impl.CLImageFormatImpl; +import com.jogamp.opencl.llb.impl.CLImageFormatImpl; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -57,7 +58,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.*; @@ -121,11 +122,11 @@ public class CLContext extends CLObject implements CLResource { NativeSizeBuffer deviceCount = NativeSizeBuffer.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)]; @@ -236,7 +237,7 @@ public class CLContext extends CLObject implements CLResource { throw new RuntimeException("no OpenCL installation found"); } - return NativeSizeBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM) + return NativeSizeBuffer.allocateDirect(3).put(CL_CONTEXT_PLATFORM) .put(platform.ID).put(0) // 0 terminated array .rewind(); } diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java index 6ca4cf38..abfb3a07 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -28,6 +28,7 @@ package com.jogamp.opencl; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.util.CLUtil; import com.jogamp.opencl.spi.CLInfoAccessor; import java.nio.ByteOrder; @@ -40,7 +41,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. diff --git a/src/com/jogamp/opencl/CLEvent.java b/src/com/jogamp/opencl/CLEvent.java index 52b316da..0b2c1eb7 100644 --- a/src/com/jogamp/opencl/CLEvent.java +++ b/src/com/jogamp/opencl/CLEvent.java @@ -29,11 +29,11 @@ package com.jogamp.opencl; import com.jogamp.opencl.impl.CLTLInfoAccessor; -import com.jogamp.opencl.impl.CLEventCallback; +import com.jogamp.opencl.llb.impl.CLEventCallback; import com.jogamp.common.nio.NativeSizeBuffer; import java.nio.Buffer; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; import static com.jogamp.opencl.CLException.*; /** diff --git a/src/com/jogamp/opencl/CLEventList.java b/src/com/jogamp/opencl/CLEventList.java index 3642d915..8c09f60f 100644 --- a/src/com/jogamp/opencl/CLEventList.java +++ b/src/com/jogamp/opencl/CLEventList.java @@ -102,6 +102,7 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable iterator() { return new EventIterator(events, size); } @@ -167,10 +170,12 @@ public final class CLEventList implements CLResource, AutoCloseable, Iterable extends CLObject implements CL @Deprecated /*public*/ final GLObjectType _getGLObjectType() { int[] array = new int[1]; - int ret = ((CLGLI)cl).clGetGLObjectInfo(ID, array, 0, null, 0); + 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]); } @@ -242,7 +243,7 @@ public abstract class CLMemory extends CLObject implements CL @Deprecated /*public*/ final int _getGLObjectID() { int[] array = new int[1]; - int ret = ((CLGLI)cl).clGetGLObjectInfo(ID, null, 0, array, 0); + int ret = ((CLGL)cl).clGetGLObjectInfo(ID, null, 0, array, 0); CLException.checkForError(ret, "error while asking for gl object info"); return array[0]; } diff --git a/src/com/jogamp/opencl/CLObject.java b/src/com/jogamp/opencl/CLObject.java index 54031884..eb1f0abf 100644 --- a/src/com/jogamp/opencl/CLObject.java +++ b/src/com/jogamp/opencl/CLObject.java @@ -29,6 +29,7 @@ package com.jogamp.opencl; import com.jogamp.common.AutoCloseable; +import com.jogamp.opencl.llb.CL; /** * Common superclass for all OpenCL objects. @@ -64,6 +65,7 @@ abstract class CLObject implements AutoCloseable { * @see java.lang.AutoCloseable */ @Deprecated + @Override public final void close() { if(this instanceof CLResource) { ((CLResource)this).release(); diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java index 4a87b43d..a494edcb 100644 --- a/src/com/jogamp/opencl/CLPlatform.java +++ b/src/com/jogamp/opencl/CLPlatform.java @@ -28,6 +28,7 @@ package com.jogamp.opencl; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.impl.CLTLAccessorFactory; import com.jogamp.common.nio.Buffers; import com.jogamp.common.os.DynamicLookupHelper; @@ -37,8 +38,8 @@ import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.gluegen.runtime.FunctionAddressResolver; 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 +56,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). diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java index e8706a73..b991c1e9 100644 --- a/src/com/jogamp/opencl/CLProgram.java +++ b/src/com/jogamp/opencl/CLProgram.java @@ -34,7 +34,7 @@ import com.jogamp.opencl.util.CLUtil; import com.jogamp.common.os.Platform; import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.common.nio.PointerBuffer; -import com.jogamp.opencl.impl.BuildProgramCallback; +import com.jogamp.opencl.llb.impl.BuildProgramCallback; import com.jogamp.opencl.util.CLBuildListener; import java.nio.ByteBuffer; import java.nio.IntBuffer; @@ -48,7 +48,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.*; /** diff --git a/src/com/jogamp/opencl/CLSampler.java b/src/com/jogamp/opencl/CLSampler.java index 015445e3..04751be2 100644 --- a/src/com/jogamp/opencl/CLSampler.java +++ b/src/com/jogamp/opencl/CLSampler.java @@ -34,7 +34,7 @@ import com.jogamp.common.nio.NativeSizeBuffer; 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.*; /** @@ -78,7 +78,7 @@ public class CLSampler extends CLObject implements CLResource { public void release() { int ret = cl.clReleaseSampler(ID); context.onSamplerReleased(this); - if(ret != CL.CL_SUCCESS) { + if(ret != CL_SUCCESS) { throw newException(ret, "can not release "+this); } } diff --git a/src/com/jogamp/opencl/CLUserEvent.java b/src/com/jogamp/opencl/CLUserEvent.java index 4bbbf3b8..22839b0a 100644 --- a/src/com/jogamp/opencl/CLUserEvent.java +++ b/src/com/jogamp/opencl/CLUserEvent.java @@ -33,7 +33,7 @@ package com.jogamp.opencl; import static com.jogamp.opencl.CLException.*; -import static com.jogamp.opencl.CL.*; +import static com.jogamp.opencl.llb.CL.*; /** * Custom, user controlled event. diff --git a/src/com/jogamp/opencl/gl/CLGLBuffer.java b/src/com/jogamp/opencl/gl/CLGLBuffer.java index 148aa83d..55cede88 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 extends CLBuffer implements C static CLGLBuffer 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); @@ -86,10 +87,12 @@ public final class CLGLBuffer extends CLBuffer implements C initCLCapacity(); } + @Override public int getGLObjectID() { return GLID; } + @Override public GLObjectType getGLObjectType() { return GLObjectType.GL_OBJECT_BUFFER; } @@ -99,6 +102,7 @@ public final class CLGLBuffer extends CLBuffer 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 ee6c2108..e688717f 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. @@ -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 extends CLImage2d 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 extends CLImage2d 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..484d00d2 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,26 +60,29 @@ public class CLGLTexture2d extends CLGLImage2d 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); CLImageFormat format = createUninitializedImageFormat(); accessor.getInfo(CL_IMAGE_FORMAT, CLImageFormatImpl.size(), format.getFormatImpl().getBuffer(), null); - int width = (int)accessor.getLong(CL_IMAGE_WIDTH); - int height = (int)accessor.getLong(CL_IMAGE_HEIGHT); + int width = 640; //(int)accessor.getLong(CL_IMAGE_WIDTH); + int height = 480; //(int)accessor.getLong(CL_IMAGE_HEIGHT); return new CLGLTexture2d(context, directBuffer, format, accessor, target, mipLevel, width, height, id, texture, flags); } + @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 extends CLImage3d 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 extends CLImage3d implements CLG return new CLGLTexture3d(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/impl/BuildProgramCallback.java b/src/com/jogamp/opencl/impl/BuildProgramCallback.java deleted file mode 100644 index cb4b36d1..00000000 --- a/src/com/jogamp/opencl/impl/BuildProgramCallback.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ - -package com.jogamp.opencl.impl; - -/** - * A callback an application can register to be called when the program executable - * has been built (successfully or unsuccessfully).
- * Note1: registering a build callback can make {@link com.jogamp.opencl.CL#clBuildProgram} non blocking (OpenCL implementation dependent).
- * 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) - */ -public interface BuildProgramCallback { - - /** - * Called when the program executable - * has been built (successfully or unsuccessfully). - */ - public void buildFinished(long cl_program); - -} diff --git a/src/com/jogamp/opencl/impl/CLEventCallback.java b/src/com/jogamp/opencl/impl/CLEventCallback.java deleted file mode 100644 index d1526a08..00000000 --- a/src/com/jogamp/opencl/impl/CLEventCallback.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ - -/* - * Created on Tuesday, July 06 2010 00:46 - */ - -package com.jogamp.opencl.impl; - -/** - * A callback for a specific command execution status. - * @author Michael Bien - */ -public interface CLEventCallback { - - public void eventStateChanged(long event, int status); - -} diff --git a/src/com/jogamp/opencl/impl/CLImpl.java b/src/com/jogamp/opencl/impl/CLImpl.java deleted file mode 100644 index 8ea44201..00000000 --- a/src/com/jogamp/opencl/impl/CLImpl.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ - -/* - * Created on Monday, June 07 2010 at 04:25 - */ -package com.jogamp.opencl.impl; - -import com.jogamp.common.nio.NativeSizeBuffer; -import com.jogamp.common.os.Platform; -import com.jogamp.common.util.LongLongHashMap; -import com.jogamp.opencl.CLErrorHandler; -import com.jogamp.opencl.CLException; -import java.nio.ByteBuffer; -import java.nio.IntBuffer; - -import static com.jogamp.common.nio.Buffers.*; - -/** - * Java bindings to OpenCL, the Open Computing Language. - * @author Michael Bien - */ -public class CLImpl extends CLAbstractImpl { - - //maps the context id to its error handler's global object pointer - private final LongLongHashMap contextCallbackMap; - - public CLImpl(CLProcAddressTable addressTable) { - super(addressTable); - this.contextCallbackMap = new LongLongHashMap(); - this.contextCallbackMap.setKeyNotFoundValue(0); - } - - public long clCreateContext(NativeSizeBuffer properties, NativeSizeBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { - - if (properties != null && !properties.isDirect()) { - throw new RuntimeException("Argument \"properties\" was not a direct buffer"); - } - - if (errcode_ret != null && !errcode_ret.isDirect()) { - throw new RuntimeException("Argument \"errcode_ret\" was not a direct buffer"); - } - - final long address = addressTable._addressof_clCreateContext; - if (address == 0) { - throw new UnsupportedOperationException("Method not available"); - } - - long[] global = new long[1]; - long ctx = this.clCreateContext0( - properties != null ? properties.getBuffer() : null, getDirectBufferByteOffset(properties), - devices != null ? devices.remaining() : 0, devices != null ? devices.getBuffer() : null, getDirectBufferByteOffset(devices), - pfn_notify, global, errcode_ret, getDirectBufferByteOffset(errcode_ret), address); - - if (pfn_notify != null && global[0] != 0) { - synchronized (contextCallbackMap) { - contextCallbackMap.put(ctx, global[0]); - } - } - return ctx; - } - - 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); - - public long clCreateContextFromType(NativeSizeBuffer 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"); - } - - if (errcode_ret != null && !errcode_ret.isDirect()) { - throw new RuntimeException("Argument \"errcode_ret\" was not a direct buffer"); - } - - final long address = addressTable._addressof_clCreateContextFromType; - if (address == 0) { - throw new UnsupportedOperationException("Method not available"); - } - - long[] global = new long[1]; - long ctx = this.clCreateContextFromType0( - properties != null ? properties.getBuffer() : null, getDirectBufferByteOffset(properties), - device_type, pfn_notify, global, errcode_ret, getDirectBufferByteOffset(errcode_ret), address); - - if (pfn_notify != null && global[0] != 0) { - synchronized (contextCallbackMap) { - contextCallbackMap.put(ctx, global[0]); - } - } - return ctx; - } - - 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); - - public int clReleaseContext(long context) { - long global = 0; - synchronized (contextCallbackMap) { - global = contextCallbackMap.remove(context); - } - - final long address = addressTable._addressof_clReleaseContext; - if (address == 0) { - throw new UnsupportedOperationException("Method not available"); - } - return clReleaseContextImpl(context, global, address); - } - - /** Interface to C language function:
int32_t {@native clReleaseContext}(cl_context context); */ - public native int clReleaseContextImpl(long context, long global, long address); - - /** Interface to C language function:
int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); */ - public int clBuildProgram(long program, int deviceCount, NativeSizeBuffer deviceList, String options, BuildProgramCallback cb) { - - if (deviceList != null && !deviceList.isDirect()) { - throw new RuntimeException("Argument \"properties\" was not a direct buffer"); - } - - final long address = addressTable._addressof_clBuildProgram; - if (address == 0) { - throw new UnsupportedOperationException("Method not available"); - } - return clBuildProgram0(program, deviceCount, deviceList != null ? deviceList.getBuffer() : null, - getDirectBufferByteOffset(deviceList), options, cb, address); - } - - /** Entry point to C language function: int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); */ - private native int clBuildProgram0(long program, int deviceCount, Object deviceList, int deviceListOffset, String options, BuildProgramCallback cb, long address); - - - public int clSetEventCallback(long event, int trigger, CLEventCallback callback) { - final long address = addressTable._addressof_clSetEventCallback; - if (address == 0) { - throw new UnsupportedOperationException("Method not available"); - } - return clSetEventCallback0(event, trigger, callback, address); - } - - private native int clSetEventCallback0(long event, int type, CLEventCallback cb, long address); - - - public int clSetMemObjectDestructorCallback(long memObjID, CLMemObjectDestructorCallback cb) { - final long address = addressTable._addressof_clSetMemObjectDestructorCallback; - if (address == 0) { - throw new UnsupportedOperationException("Method not available"); - } - return clSetMemObjectDestructorCallback0(memObjID, cb, address); - } - - private native int clSetMemObjectDestructorCallback0(long memObjID, CLMemObjectDestructorCallback cb, long address); - - - /** Interface to C language function:
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); - @param origin a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param range a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param event a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param errcode_ret a direct {@link java.nio.IntBuffer} */ - public ByteBuffer clEnqueueMapImage(long command_queue, long image, int blocking_map, long map_flags, - NativeSizeBuffer origin, NativeSizeBuffer range, - NativeSizeBuffer image_row_pitch, NativeSizeBuffer image_slice_pitch, - int num_events_in_wait_list, - NativeSizeBuffer event_wait_list, NativeSizeBuffer event, IntBuffer errcode_ret) { - - if (origin != null && !origin.isDirect()) { - throw new CLException("Argument \"origin\" was not a direct buffer"); - } - if (range != null && !range.isDirect()) { - throw new CLException("Argument \"range\" was not a direct buffer"); - } - if (image_row_pitch != null && !image_row_pitch.isDirect()) { - throw new CLException("Argument \"image_row_pitch\" was not a direct buffer"); - } - if (image_slice_pitch != null && !image_slice_pitch.isDirect()) { - throw new CLException("Argument \"image_slice_pitch\" was not a direct buffer"); - } - if (event_wait_list != null && !event_wait_list.isDirect()) { - throw new CLException("Argument \"event_wait_list\" was not a direct buffer"); - } - if (event != null && !event.isDirect()) { - throw new CLException("Argument \"event\" was not a direct buffer"); - } - if (errcode_ret != null && !errcode_ret.isDirect()) { - throw new CLException("Argument \"errcode_ret\" was not a direct buffer"); - } - - final long mapImageAddress = addressTable._addressof_clEnqueueMapImage; - if (mapImageAddress == 0) { - throw new UnsupportedOperationException("Method not available"); - } - final long getImageInfoAddress = addressTable._addressof_clGetImageInfo; - if (getImageInfoAddress == 0) { - throw new UnsupportedOperationException("Method not available"); - } - ByteBuffer _res; - _res = clEnqueueMapImage0(command_queue, image, blocking_map, map_flags, origin != null ? origin.getBuffer() : null, - getDirectBufferByteOffset(origin), range != null ? range.getBuffer() : null, - getDirectBufferByteOffset(range), image_row_pitch != null ? image_row_pitch.getBuffer() : null, - getDirectBufferByteOffset(image_row_pitch), image_slice_pitch != null ? image_slice_pitch.getBuffer() : null, - getDirectBufferByteOffset(image_slice_pitch), num_events_in_wait_list, - event_wait_list != null ? event_wait_list.getBuffer() : null, getDirectBufferByteOffset(event_wait_list), - event != null ? event.getBuffer() : null, getDirectBufferByteOffset(event), errcode_ret, - getDirectBufferByteOffset(errcode_ret)); - if (_res == null) { - return null; - } - nativeOrder(_res); - return _res; - } - - /** Entry point to C language function: 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); - @param origin a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param range a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @param event a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} - @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, - int image_row_pitch_byte_offset, Object image_slice_pitch, int image_slice_pitch_byte_offset, - int num_events_in_wait_list, Object event_wait_list, int event_wait_list_byte_offset, Object event, - int event_byte_offset, Object errcode_ret, int errcode_ret_byte_offset); - - /** - * Returns the extension function address for the given function name. - */ - public long clGetExtensionFunctionAddress(String name) { - ByteBuffer res = super.clGetExtensionFunctionAddressImpl(name); - if(res == null) { - return 0; - }else if (Platform.is32Bit()) { - return res.getInt(); - } else { - return res.getLong(); - } - } - - public CLProcAddressTable getAddressTable() { - return addressTable; - } - - /* - private static void convert32To64(long[] values) { - if (values.length % 2 == 1) { - values[values.length - 1] = values[values.length / 2] >>> 32; - } - for (int i = values.length - 1 - values.length % 2; i >= 0; i -= 2) { - long temp = values[i / 2]; - values[i - 1] = temp >>> 32; - values[i] = temp & 0x00000000FFFFFFFFL; - } - } - */ - - - -} diff --git a/src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java b/src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java deleted file mode 100644 index c040d2ce..00000000 --- a/src/com/jogamp/opencl/impl/CLMemObjectDestructorCallback.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2009 - 2010 JogAmp Community. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of JogAmp Community. - */ - -/* - * Created on Thursday, September 02 2010 23:09 - */ - -package com.jogamp.opencl.impl; - -/** - * A callback which is invoked by the OpenCL implementation when the memory - * object is deleted and its resources freed. - * @author Michael Bien - */ -public interface CLMemObjectDestructorCallback { - - /** - * - */ - public void memoryDeallocated(long memObjID); - -} diff --git a/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java b/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java index 1c7f9526..b5ad1d8a 100644 --- a/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java +++ b/src/com/jogamp/opencl/impl/CLTLAccessorFactory.java @@ -5,7 +5,7 @@ package com.jogamp.opencl.impl; import java.nio.IntBuffer; import com.jogamp.common.nio.NativeSizeBuffer; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.CL; import com.jogamp.opencl.spi.CLAccessorFactory; import com.jogamp.opencl.spi.CLInfoAccessor; import com.jogamp.opencl.spi.CLPlatformInfoAccessor; diff --git a/src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java b/src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java new file mode 100644 index 00000000..51bde322 --- /dev/null +++ b/src/com/jogamp/opencl/llb/impl/BuildProgramCallback.java @@ -0,0 +1,47 @@ +/* + * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +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).
+ * Note1: registering a build callback can make {@link com.jogamp.opencl.llb.CL#clBuildProgram} non blocking (OpenCL implementation dependent).
+ * Note2: the thread which calls this method is unspecified. The Application should ensure proper synchronization. + * @author Michael Bien + * @see com.jogamp.opencl.llb.CL#clBuildProgram + */ +public interface BuildProgramCallback { + + /** + * Called when the program executable + * has been built (successfully or unsuccessfully). + */ + public void buildFinished(long cl_program); + +} diff --git a/src/com/jogamp/opencl/llb/impl/CLEventCallback.java b/src/com/jogamp/opencl/llb/impl/CLEventCallback.java new file mode 100644 index 00000000..1373995a --- /dev/null +++ b/src/com/jogamp/opencl/llb/impl/CLEventCallback.java @@ -0,0 +1,43 @@ +/* + * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +/* + * Created on Tuesday, July 06 2010 00:46 + */ + +package com.jogamp.opencl.llb.impl; + +/** + * A callback for a specific command execution status. + * @author Michael Bien + */ +public interface CLEventCallback { + + public void eventStateChanged(long event, int status); + +} diff --git a/src/com/jogamp/opencl/llb/impl/CLImpl.java b/src/com/jogamp/opencl/llb/impl/CLImpl.java new file mode 100644 index 00000000..5de3126d --- /dev/null +++ b/src/com/jogamp/opencl/llb/impl/CLImpl.java @@ -0,0 +1,291 @@ +/* + * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +/* + * Created on Monday, June 07 2010 at 04:25 + */ +package com.jogamp.opencl.llb.impl; + +import com.jogamp.common.nio.NativeSizeBuffer; +import com.jogamp.common.os.Platform; +import com.jogamp.common.util.LongLongHashMap; +import com.jogamp.opencl.CLErrorHandler; +import com.jogamp.opencl.CLException; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +import static com.jogamp.common.nio.Buffers.*; + +/** + * Java bindings to OpenCL, the Open Computing Language. + * @author Michael Bien + */ +public class CLImpl extends CLAbstractImpl { + + //maps the context id to its error handler's global object pointer + private final LongLongHashMap contextCallbackMap; + + public CLImpl(CLProcAddressTable addressTable) { + super(addressTable); + this.contextCallbackMap = new LongLongHashMap(); + this.contextCallbackMap.setKeyNotFoundValue(0); + } + + @Override + public long clCreateContext(NativeSizeBuffer properties, NativeSizeBuffer devices, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { + + if (properties != null && !properties.isDirect()) { + throw new RuntimeException("Argument \"properties\" was not a direct buffer"); + } + + if (errcode_ret != null && !errcode_ret.isDirect()) { + throw new RuntimeException("Argument \"errcode_ret\" was not a direct buffer"); + } + + final long address = addressTable._addressof_clCreateContext; + if (address == 0) { + throw new UnsupportedOperationException("Method not available"); + } + + long[] global = new long[1]; + long ctx = this.clCreateContext0( + properties != null ? properties.getBuffer() : null, getDirectBufferByteOffset(properties), + devices != null ? devices.remaining() : 0, devices != null ? devices.getBuffer() : null, getDirectBufferByteOffset(devices), + pfn_notify, global, errcode_ret, getDirectBufferByteOffset(errcode_ret), address); + + if (pfn_notify != null && global[0] != 0) { + synchronized (contextCallbackMap) { + contextCallbackMap.put(ctx, global[0]); + } + } + return ctx; + } + + 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(NativeSizeBuffer 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"); + } + + if (errcode_ret != null && !errcode_ret.isDirect()) { + throw new RuntimeException("Argument \"errcode_ret\" was not a direct buffer"); + } + + final long address = addressTable._addressof_clCreateContextFromType; + if (address == 0) { + throw new UnsupportedOperationException("Method not available"); + } + + long[] global = new long[1]; + long ctx = this.clCreateContextFromType0( + properties != null ? properties.getBuffer() : null, getDirectBufferByteOffset(properties), + device_type, pfn_notify, global, errcode_ret, getDirectBufferByteOffset(errcode_ret), address); + + if (pfn_notify != null && global[0] != 0) { + synchronized (contextCallbackMap) { + contextCallbackMap.put(ctx, global[0]); + } + } + return ctx; + } + + 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) { + global = contextCallbackMap.remove(context); + } + + final long address = addressTable._addressof_clReleaseContext; + if (address == 0) { + throw new UnsupportedOperationException("Method not available"); + } + return clReleaseContextImpl(context, global, address); + } + + /** Interface to C language function:
int32_t {@native clReleaseContext}(cl_context context); */ + public native int clReleaseContextImpl(long context, long global, long address); + + /** Interface to C language function:
int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); */ + @Override + public int clBuildProgram(long program, int deviceCount, NativeSizeBuffer deviceList, String options, BuildProgramCallback cb) { + + if (deviceList != null && !deviceList.isDirect()) { + throw new RuntimeException("Argument \"properties\" was not a direct buffer"); + } + + final long address = addressTable._addressof_clBuildProgram; + if (address == 0) { + throw new UnsupportedOperationException("Method not available"); + } + return clBuildProgram0(program, deviceCount, deviceList != null ? deviceList.getBuffer() : null, + getDirectBufferByteOffset(deviceList), options, cb, address); + } + + /** Entry point to C language function: int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); */ + 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) { + throw new UnsupportedOperationException("Method not available"); + } + return clSetEventCallback0(event, trigger, callback, address); + } + + 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) { + throw new UnsupportedOperationException("Method not available"); + } + return clSetMemObjectDestructorCallback0(memObjID, cb, address); + } + + private native int clSetMemObjectDestructorCallback0(long memObjID, CLMemObjectDestructorCallback cb, long address); + + + /** Interface to C language function:
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); + @param origin a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param range a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param event a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param errcode_ret a direct {@link java.nio.IntBuffer} */ + @Override + public ByteBuffer clEnqueueMapImage(long command_queue, long image, int blocking_map, long map_flags, + NativeSizeBuffer origin, NativeSizeBuffer range, + NativeSizeBuffer image_row_pitch, NativeSizeBuffer image_slice_pitch, + int num_events_in_wait_list, + NativeSizeBuffer event_wait_list, NativeSizeBuffer event, IntBuffer errcode_ret) { + + if (origin != null && !origin.isDirect()) { + throw new CLException("Argument \"origin\" was not a direct buffer"); + } + if (range != null && !range.isDirect()) { + throw new CLException("Argument \"range\" was not a direct buffer"); + } + if (image_row_pitch != null && !image_row_pitch.isDirect()) { + throw new CLException("Argument \"image_row_pitch\" was not a direct buffer"); + } + if (image_slice_pitch != null && !image_slice_pitch.isDirect()) { + throw new CLException("Argument \"image_slice_pitch\" was not a direct buffer"); + } + if (event_wait_list != null && !event_wait_list.isDirect()) { + throw new CLException("Argument \"event_wait_list\" was not a direct buffer"); + } + if (event != null && !event.isDirect()) { + throw new CLException("Argument \"event\" was not a direct buffer"); + } + if (errcode_ret != null && !errcode_ret.isDirect()) { + throw new CLException("Argument \"errcode_ret\" was not a direct buffer"); + } + + final long mapImageAddress = addressTable._addressof_clEnqueueMapImage; + if (mapImageAddress == 0) { + throw new UnsupportedOperationException("Method not available"); + } + final long getImageInfoAddress = addressTable._addressof_clGetImageInfo; + if (getImageInfoAddress == 0) { + throw new UnsupportedOperationException("Method not available"); + } + ByteBuffer _res; + _res = clEnqueueMapImage0(command_queue, image, blocking_map, map_flags, origin != null ? origin.getBuffer() : null, + getDirectBufferByteOffset(origin), range != null ? range.getBuffer() : null, + getDirectBufferByteOffset(range), image_row_pitch != null ? image_row_pitch.getBuffer() : null, + getDirectBufferByteOffset(image_row_pitch), image_slice_pitch != null ? image_slice_pitch.getBuffer() : null, + getDirectBufferByteOffset(image_slice_pitch), num_events_in_wait_list, + event_wait_list != null ? event_wait_list.getBuffer() : null, getDirectBufferByteOffset(event_wait_list), + event != null ? event.getBuffer() : null, getDirectBufferByteOffset(event), errcode_ret, + getDirectBufferByteOffset(errcode_ret)); + if (_res == null) { + return null; + } + nativeOrder(_res); + return _res; + } + + /** Entry point to C language function: 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); + @param origin a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param range a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param image_row_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param image_slice_pitch a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param event_wait_list a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @param event a direct {@link com.jogamp.gluegen.common.nio.NativeSizeBuffer} + @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, + int image_row_pitch_byte_offset, Object image_slice_pitch, int image_slice_pitch_byte_offset, + int num_events_in_wait_list, Object event_wait_list, int event_wait_list_byte_offset, Object event, + int event_byte_offset, Object errcode_ret, int errcode_ret_byte_offset); + + /** + * Returns the extension function address for the given function name. + */ + public long clGetExtensionFunctionAddress(String name) { + ByteBuffer res = super.clGetExtensionFunctionAddressImpl(name); + if(res == null) { + return 0; + }else if (Platform.is32Bit()) { + return res.getInt(); + } else { + return res.getLong(); + } + } + + public CLProcAddressTable getAddressTable() { + return addressTable; + } + + /* + private static void convert32To64(long[] values) { + if (values.length % 2 == 1) { + values[values.length - 1] = values[values.length / 2] >>> 32; + } + for (int i = values.length - 1 - values.length % 2; i >= 0; i -= 2) { + long temp = values[i / 2]; + values[i - 1] = temp >>> 32; + values[i] = temp & 0x00000000FFFFFFFFL; + } + } + */ + + + +} diff --git a/src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java b/src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java new file mode 100644 index 00000000..5ed57cce --- /dev/null +++ b/src/com/jogamp/opencl/llb/impl/CLMemObjectDestructorCallback.java @@ -0,0 +1,47 @@ +/* + * Copyright 2009 - 2010 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + +/* + * Created on Thursday, September 02 2010 23:09 + */ + +package com.jogamp.opencl.llb.impl; + +/** + * A callback which is invoked by the OpenCL implementation when the memory + * object is deleted and its resources freed. + * @author Michael Bien + */ +public interface CLMemObjectDestructorCallback { + + /** + * + */ + public void memoryDeallocated(long memObjID); + +} diff --git a/src/com/jogamp/opencl/spi/CLAccessorFactory.java b/src/com/jogamp/opencl/spi/CLAccessorFactory.java index 6239bb37..752891b4 100644 --- a/src/com/jogamp/opencl/spi/CLAccessorFactory.java +++ b/src/com/jogamp/opencl/spi/CLAccessorFactory.java @@ -3,7 +3,7 @@ */ package com.jogamp.opencl.spi; -import com.jogamp.opencl.CL; +import com.jogamp.opencl.llb.CL; /** * Implementations of this interface are factories responsible for creating CLAccessors. diff --git a/src/com/jogamp/opencl/util/CLBuildListener.java b/src/com/jogamp/opencl/util/CLBuildListener.java index 9a520582..05517850 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).
- * Note1: registering a build callback can make {@link com.jogamp.opencl.CL#clBuildProgram} non blocking (OpenCL implementation dependent).
+ * Note1: registering a build callback can make {@link com.jogamp.opencl.llb.CL#clBuildProgram} non blocking (OpenCL implementation dependent).
* 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.NativeSizeBuffer, java.lang.String, com.jogamp.opencl.impl.BuildProgramCallback) + * @see com.jogamp.opencl.llb.CL#clBuildProgram(long, int, com.jogamp.common.nio.NativeSizeBuffer, java.lang.String, com.jogamp.opencl.llb.impl.BuildProgramCallback) */ public interface CLBuildListener { 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/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() { - 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() { - public Object run() { + @Override public Object run() { sb.append(GlueGenVersion.getInstance().toString()); return null; } 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..4d3b0cf6 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(); 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 9e603879..655bfc64 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.opencl.llb.impl.BuildProgramCallback; import com.jogamp.common.nio.NativeSizeBuffer; +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() { + @Override public Object call() { try { out.println("###start iteration " + n); -- cgit v1.2.3