Jogamp
Add explicit version number to original CL impl classes.
authorWade Walker <wwalker3@austin.rr.com>
Sat, 12 Sep 2015 19:28:16 +0000 (14:28 -0500)
committerWade Walker <wwalker3@austin.rr.com>
Sun, 8 Nov 2015 20:05:29 +0000 (14:05 -0600)
This makes all three versions (1.1, 1.2, and 2.0) use the same naming
convention, and sets me up to use the unversioned name to factor out
code common to all three.

make/build.xml
make/config/cl-impl-11.cfg [moved from make/config/cl-impl.cfg with 83% similarity]
make/config/clImplCustomCode11.c [moved from make/config/clImplCustomCode.c with 94% similarity]
make/config/clImplCustomCode11.java [moved from make/config/clImplCustomCode.java with 92% similarity]
src/com/jogamp/opencl/CLPlatform.java
src/com/jogamp/opencl/llb/impl/CLDynamicLibraryBundleInfo.java
src/com/jogamp/opencl/llb/impl/CLImpl11.java [moved from src/com/jogamp/opencl/llb/impl/CLImpl.java with 99% similarity]
src/com/jogamp/opencl/util/CLInfo.java
test/com/jogamp/opencl/test/util/MiscUtils.java

index cbe251a..b1bb709 100644 (file)
         <echo message="Generating CLAbstractImpl.java, CLAbstractImpl_JNI.c, and CLProcAddressTable.java for OpenCL version 1.1"/>
         <gluegen src="${stub.includes}/opencl.h"
                  outputRootDir="${build}"
-                 config="${config}/cl-impl.cfg"
+                 config="${config}/cl-impl-11.cfg"
                  includeRefid="stub.includes.fileset.all.11"
                  literalInclude="${stub.includes.gluegen.all}"
                  emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter"
similarity index 83%
rename from make/config/cl-impl.cfg
rename to make/config/cl-impl-11.cfg
index f785066..9a49ea6 100644 (file)
@@ -8,19 +8,19 @@ Import com.jogamp.opencl.llb.gl.CLGL
 Import java.security.AccessController
 Import java.security.PrivilegedAction
 
-ClassJavadoc CLAbstractImpl /**
-ClassJavadoc CLAbstractImpl  * Java bindings to OpenCL, the Open Computing Language (generated).
-ClassJavadoc CLAbstractImpl  * @author Michael Bien, GlueGen, et al.
-ClassJavadoc CLAbstractImpl  */
+ClassJavadoc CLAbstractImpl11 /**
+ClassJavadoc CLAbstractImpl11  * Java bindings to OpenCL, the Open Computing Language (generated).
+ClassJavadoc CLAbstractImpl11  * @author Michael Bien, GlueGen, et al.
+ClassJavadoc CLAbstractImpl11  */
 
-ImplJavaClass CLAbstractImpl
-AccessControl CLAbstractImpl PUBLIC_ABSTRACT
-Implements CLAbstractImpl CLGL
+ImplJavaClass CLAbstractImpl11
+AccessControl CLAbstractImpl11 PUBLIC_ABSTRACT
+Implements CLAbstractImpl11 CLGL
 
 LocalProcAddressCallingConvention __ALL__ CL_API_CALL
 
 EmitProcAddressTable true
-ProcAddressTableClassName CLProcAddressTable
+ProcAddressTableClassName CLProcAddressTable11
 GetProcAddressTableExpr addressTable
 ProcAddressNameExpr $UpperCase(arg)
 ForceProcAddressGen __ALL__
@@ -93,7 +93,7 @@ ManuallyImplement clEnqueueMapImage
 ForceProcAddressGen clEnqueueMapImage
 
 #include custom code
-IncludeAs CustomJavaCode CLAbstractImpl clImplCustomCode.java
-ManualStaticInitCall CLAbstractImpl
-IncludeAs CustomCCode clImplCustomCode.c
+IncludeAs CustomJavaCode CLAbstractImpl11 clImplCustomCode11.java
+ManualStaticInitCall CLAbstractImpl11
+IncludeAs CustomCCode clImplCustomCode11.c
 
similarity index 94%
rename from make/config/clImplCustomCode.c
rename to make/config/clImplCustomCode11.c
index 1d64086..1e772d9 100644 (file)
@@ -115,7 +115,7 @@ CL_CALLBACK void memObjDestructorCallback(cl_mem mem, void * object) {
 // extern CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0;
 
 JNIEXPORT jlong JNICALL
-Java_com_jogamp_opencl_llb_impl_CLAbstractImpl_dispatch_1clGetExtensionFunctionAddressStatic(JNIEnv *env, jclass _unused, jstring fname, jlong procAddress) {
+Java_com_jogamp_opencl_llb_impl_CLAbstractImpl11_dispatch_1clGetExtensionFunctionAddressStatic(JNIEnv *env, jclass _unused, jstring fname, jlong procAddress) {
   typedef void* (CL_API_CALL * _local_LPCLGETPROCADDRESS)(const char *  fname);
   _local_LPCLGETPROCADDRESS ptr_clGetExtensionFunctionAddress;
   const char* _strchars_fname = NULL;
@@ -147,7 +147,7 @@ Java_com_jogamp_opencl_llb_impl_CLAbstractImpl_dispatch_1clGetExtensionFunctionA
  *                                                      cl_int *                       errcode_ret);
  */
 JNIEXPORT jlong JNICALL
-Java_com_jogamp_opencl_llb_impl_CLImpl_clCreateContextFromType0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl11_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;
@@ -200,7 +200,7 @@ Java_com_jogamp_opencl_llb_impl_CLImpl_clCreateContextFromType0(JNIEnv *env, job
  *                cl_int *                   errcode_ret   ) CL_API_SUFFIX__VERSION_1_0;
  */
 JNIEXPORT jlong JNICALL
-Java_com_jogamp_opencl_llb_impl_CLImpl_clCreateContext0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl11_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;
@@ -251,7 +251,7 @@ Java_com_jogamp_opencl_llb_impl_CLImpl_clCreateContext0(JNIEnv *env, jobject _un
  *     C function: int32_t clReleaseContextImpl(cl_context context);
  */
 JNIEXPORT jint JNICALL
-Java_com_jogamp_opencl_llb_impl_CLImpl_clReleaseContextImpl(JNIEnv *env, jobject _unused, jlong context, jlong global, jlong procAddress) {
+Java_com_jogamp_opencl_llb_impl_CLImpl11_clReleaseContextImpl(JNIEnv *env, jobject _unused, jlong context, jlong global, jlong procAddress) {
 
     int32_t _res;
     typedef int32_t (*function)(cl_context);
@@ -277,7 +277,7 @@ Java_com_jogamp_opencl_llb_impl_CLImpl_clReleaseContextImpl(JNIEnv *env, jobject
  *               void *                  user_data   ) CL_API_SUFFIX__VERSION_1_0;
  */
 JNIEXPORT jint JNICALL
-Java_com_jogamp_opencl_llb_impl_CLImpl_clBuildProgram0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl11_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;
@@ -327,7 +327,7 @@ Java_com_jogamp_opencl_llb_impl_CLImpl_clBuildProgram0(JNIEnv *env, jobject _unu
  *     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_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,
+Java_com_jogamp_opencl_llb_impl_CLImpl11_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,
@@ -404,7 +404,7 @@ Java_com_jogamp_opencl_llb_impl_CLImpl_clEnqueueMapImage0__JJIJLjava_lang_Object
 }
 
 JNIEXPORT jint JNICALL
-Java_com_jogamp_opencl_llb_impl_CLImpl_clSetEventCallback0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl11_clSetEventCallback0(JNIEnv *env, jobject _unused,
         jlong event, jint trigger, jobject listener, jlong procAddress) {
 
     cl_event _event = (cl_event)event;
@@ -420,7 +420,7 @@ Java_com_jogamp_opencl_llb_impl_CLImpl_clSetEventCallback0(JNIEnv *env, jobject
 }
 
 JNIEXPORT jint JNICALL
-Java_com_jogamp_opencl_llb_impl_CLImpl_clSetMemObjectDestructorCallback0(JNIEnv *env, jobject _unused,
+Java_com_jogamp_opencl_llb_impl_CLImpl11_clSetMemObjectDestructorCallback0(JNIEnv *env, jobject _unused,
         jlong mem, jobject listener, jlong procAddress) {
 
     cl_mem _mem = (cl_mem)mem;
similarity index 92%
rename from make/config/clImplCustomCode.java
rename to make/config/clImplCustomCode11.java
index e4fd2dc..0dcb770 100644 (file)
@@ -1,10 +1,10 @@
 
     /** If null, OpenCL is not available on this machine. */
     static final DynamicLibraryBundle dynamicLookupHelper;
-    protected static final CLProcAddressTable addressTable;
+    protected static final CLProcAddressTable11 addressTable;
 
     static {
-        addressTable = new CLProcAddressTable();
+        addressTable = new CLProcAddressTable11();
         dynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() {
                                   public DynamicLibraryBundle run() {
                                       final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new CLDynamicLibraryBundleInfo());
@@ -32,7 +32,7 @@
      * @returns true if OpenCL is available on this machine.
      */
     public static boolean isAvailable() { return dynamicLookupHelper != null; }
-    public static CLProcAddressTable getCLProcAddressTable() { return addressTable; }
+    public static CLProcAddressTable11 getCLProcAddressTable() { return addressTable; }
 
     static long clGetExtensionFunctionAddress(long clGetExtensionFunctionAddressHandle, java.lang.String procname)
     {
@@ -42,7 +42,7 @@
         return dispatch_clGetExtensionFunctionAddressStatic(procname, clGetExtensionFunctionAddressHandle);
     }
 
-    public CLAbstractImpl() {
+    public CLAbstractImpl11() {
     }
 
     /** Entry point (through function pointer) to C language function: <br> <code> void* clGetExtensionFunctionAddress(const char *  fname); </code>    */
index d63f670..17fbe66 100644 (file)
@@ -46,8 +46,8 @@ 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.llb.impl.CLAbstractImpl;
-import com.jogamp.opencl.llb.impl.CLImpl;
+import com.jogamp.opencl.llb.impl.CLAbstractImpl11;
+import com.jogamp.opencl.llb.impl.CLImpl11;
 import com.jogamp.opencl.spi.CLAccessorFactory;
 import com.jogamp.opencl.util.Filter;
 
@@ -145,7 +145,7 @@ public class CLPlatform {
      * @returns true if OpenCL is available on this machine,
      * i.e. all native libraries could be loaded (CL and CL/JNI).
      */
-    public static boolean isAvailable() { return CLAbstractImpl.isAvailable(); }
+    public static boolean isAvailable() { return CLAbstractImpl11.isAvailable(); }
 
     /**
      * Eagerly initializes JOCL. Subsequent calls do nothing.
@@ -176,10 +176,10 @@ public class CLPlatform {
             }
         }
 
-        if( !CLAbstractImpl.isAvailable() ) {
+        if( !CLAbstractImpl11.isAvailable() ) {
             throw new JogampRuntimeException("JOCL is not available");
         }
-        cl = new CLImpl();
+        cl = new CLImpl11();
     }
 
     /**
index 59bb072..709b58a 100644 (file)
@@ -143,7 +143,7 @@ public final class CLDynamicLibraryBundleInfo implements DynamicLibraryBundleInf
             funcName = funcName.substring(0, funcName.length() - Impl_len);
         }
         if( funcName.endsWith("KHR") || funcName.endsWith("EXT") ) {
-            return CLAbstractImpl.clGetExtensionFunctionAddress(toolGetProcAddressHandle, funcName);
+            return CLAbstractImpl11.clGetExtensionFunctionAddress(toolGetProcAddressHandle, funcName);
         }
         return 0; // on libs ..
     }
similarity index 99%
rename from src/com/jogamp/opencl/llb/impl/CLImpl.java
rename to src/com/jogamp/opencl/llb/impl/CLImpl11.java
index 6eb9cde..fc335ec 100644 (file)
@@ -44,12 +44,12 @@ import static com.jogamp.common.nio.Buffers.*;
  * Java bindings to OpenCL, the Open Computing Language.
  * @author Michael Bien, et al.
  */
-public class CLImpl extends CLAbstractImpl {
+public class CLImpl11 extends CLAbstractImpl11 {
 
     //maps the context id to its error handler's global object pointer
     private final LongLongHashMap contextCallbackMap;
 
-    public CLImpl() {
+    public CLImpl11() {
         super();
         this.contextCallbackMap = new LongLongHashMap();
         this.contextCallbackMap.setKeyNotFoundValue(0);
@@ -253,7 +253,7 @@ public class CLImpl extends CLAbstractImpl {
             int event_byte_offset, Object errcode_ret, int errcode_ret_byte_offset,
             long getImageInfoAddress, long mapImageAddress);
 
-    public CLProcAddressTable getAddressTable() {
+    public CLProcAddressTable11 getAddressTable() {
         return addressTable;
     }
 
index 2dfbb5e..e6d55b5 100644 (file)
@@ -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.llb.impl.CLImpl;
+import com.jogamp.opencl.llb.impl.CLImpl11;
 import java.util.Map;
 
 
@@ -58,7 +58,7 @@ public class CLInfo {
 
         // binding
         sb.append("CL_BINDING_UNAVAILABLE_FUNCTIONS: ");
-        sb.append(((CLImpl) CLPlatform.getLowLevelCLInterface()).getAddressTable().getNullPointerFunctions());
+        sb.append(((CLImpl11) CLPlatform.getLowLevelCLInterface()).getAddressTable().getNullPointerFunctions());
         sb.append("\n");
 
         // OpenCL
index 9cd625b..77f0993 100644 (file)
@@ -34,7 +34,6 @@ import java.util.Random;
 import java.util.Set;
 
 import com.jogamp.common.os.Platform;
-import com.jogamp.opencl.llb.impl.CLAbstractImpl;
 
 import static java.lang.System.*;
 import static org.junit.Assert.*;
http://JogAmp.org git info: FAQ, tutorial and man pages.