diff options
author | Sven Gothel <[email protected]> | 2014-01-26 02:14:26 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-01-26 02:14:26 +0100 |
commit | aac4c5fc4ab7c77eff3b71f518100dd182ec2c33 (patch) | |
tree | 3883e6e9a97146a0cbf503ff67f7b58870fe22dd /make/config/clImplCustomCode.java | |
parent | ac84afd26ad3b34851a423fb90e6c819b9dc9495 (diff) |
Cleanup Build: GlueGen config files, stub_includes; Add JoclVersion, Android JoclVersionActivity
Cleanup Build:
- Move gluegen config files into make/config (cleanup)
- Move stub_includes into respective folder make/stub_includes
and keep resources 'clean'
JoclVersion:
- Analoge to JoglVersion, replaces JOCLVersion (deprecated for now)
- Added text based CL info dump.
JoclVersionActivity:
- Analog to JoclVersionActivity
- Added full launch .. tested on Android (but no OpenCL avail.)
Diffstat (limited to 'make/config/clImplCustomCode.java')
-rw-r--r-- | make/config/clImplCustomCode.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/make/config/clImplCustomCode.java b/make/config/clImplCustomCode.java new file mode 100644 index 00000000..bee53425 --- /dev/null +++ b/make/config/clImplCustomCode.java @@ -0,0 +1,53 @@ + + static final DynamicLibraryBundle dynamicLookupHelper; + protected static final CLProcAddressTable addressTable; + + static { + addressTable = new CLProcAddressTable(); + if(null==addressTable) { + throw new RuntimeException("Couldn't instantiate ALProcAddressTable"); + } + + dynamicLookupHelper = AccessController.doPrivileged(new PrivilegedAction<DynamicLibraryBundle>() { + public DynamicLibraryBundle run() { + final DynamicLibraryBundle bundle = new DynamicLibraryBundle(new CLDynamicLibraryBundleInfo()); + if(null==bundle) { + throw new RuntimeException("Null CLDynamicLookupHelper"); + } + if(!bundle.isToolLibLoaded()) { + throw new RuntimeException("Couln't load native CL library"); + } + if(!bundle.isLibComplete()) { + throw new RuntimeException("Couln't load native CL/JNI glue library"); + } + addressTable.reset(bundle); + return bundle; + } } ); + } + + public static CLProcAddressTable getCLProcAddressTable() { return addressTable; } + + static long clGetExtensionFunctionAddress(long clGetExtensionFunctionAddressHandle, java.lang.String procname) + { + if (clGetExtensionFunctionAddressHandle == 0) { + throw new RuntimeException("Passed null pointer for method \"clGetExtensionFunctionAddress\""); + } + return dispatch_clGetExtensionFunctionAddressStatic(procname, clGetExtensionFunctionAddressHandle); + } + + public CLAbstractImpl() { + } + + /** Entry point (through function pointer) to C language function: <br> <code> void* clGetExtensionFunctionAddress(const char * fname); </code> */ + long clGetExtensionFunctionAddress(String fname) { + + final long __addr_ = addressTable._addressof_clGetExtensionFunctionAddress; + if (__addr_ == 0) { + throw new UnsupportedOperationException("Method \"clGetExtensionFunctionAddress\" not available"); + } + return dispatch_clGetExtensionFunctionAddressStatic(fname, __addr_); + } + + /** Entry point (through function pointer) to C language function: <br> <code> void* clGetExtensionFunctionAddress(const char * fname); </code> */ + private static native long dispatch_clGetExtensionFunctionAddressStatic(String fname, long procAddress); + |