diff options
Diffstat (limited to 'resources/clImplCustomCode.java')
-rw-r--r-- | resources/clImplCustomCode.java | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/resources/clImplCustomCode.java b/resources/clImplCustomCode.java index 0d25ddb6..d74d5b82 100644 --- a/resources/clImplCustomCode.java +++ b/resources/clImplCustomCode.java @@ -1,10 +1,21 @@ - public long clCreateContext(IntBuffer properties, long[] devices, CreateContextCallback cb, Object userData, IntBuffer errcode_ret) { + public long clCreateContext(IntBuffer properties, long[] devices, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret) { - throw new RuntimeException("not yet implemented, use clCreateContextFromType instead"); -// return this.clCreateContext0(properties, offset1, devices, cb, null, errcode_ret, offset2); + if(pfn_notify != null) + throw new RuntimeException("asynchronous execution with callback is not yet implemented, pass null through this method to block until complete."); + + if(userData != null) + System.err.println("WARNING: userData not yet implemented... ignoring"); + + int listLength = 0; + if(devices != null) + listLength = devices.length; + + return this.clCreateContext1( + BufferFactory.getArray(properties), BufferFactory.getIndirectBufferByteOffset(properties), listLength, devices, null, null, + BufferFactory.getArray(errcode_ret), BufferFactory.getIndirectBufferByteOffset(errcode_ret) ); } - private native long clCreateContext0(Object cl_context_properties, int props_offset, long[] devices, CreateContextCallback pfn_notify, Object userData, Object errcode_ret, int err_offset); + private native long clCreateContext1(Object cl_context_properties, int props_offset, int deviceCount, long[] devices, CreateContextCallback pfn_notify, Object userData, Object errcode_ret, int err_offset); public long clCreateContextFromType(IntBuffer properties, long device_type, CreateContextCallback pfn_notify, Object userData, IntBuffer errcode_ret) { @@ -35,8 +46,8 @@ if(deviceList != null) listLength = deviceList.length; - return clBuildProgram0(program, listLength, deviceList, 0, options, cb, userData); + return clBuildProgram1(program, listLength, deviceList, 0, options, cb, userData); } /** Entry point to C language function: <code> int32_t clBuildProgram(cl_program, uint32_t, cl_device_id * , const char * , void * ); </code> */ - private native int clBuildProgram0(long program, int devices, Object deviceList, int arg2_byte_offset, String options, BuildProgramCallback cb, Object userData); + private native int clBuildProgram1(long program, int devices, Object deviceList, int arg2_byte_offset, String options, BuildProgramCallback cb, Object userData); |