diff options
-rw-r--r-- | resources/clImplCustomCode.java | 10 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/resources/clImplCustomCode.java b/resources/clImplCustomCode.java index d2993f96..4f9f4c2e 100644 --- a/resources/clImplCustomCode.java +++ b/resources/clImplCustomCode.java @@ -15,6 +15,9 @@ 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"); + long[] global = new long[1]; long ctx = this.clCreateContext0( properties!=null?properties.getBuffer():null, Buffers.getDirectBufferByteOffset(properties), @@ -28,7 +31,7 @@ } return ctx; } - private native long clCreateContext0(Object cl_context_properties, int props_offset, int numDevices, Object devices, int devices_offset, CLErrorHandler pfn_notify, long[] global, Object errcode_ret, int err_offset); + 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); public long clCreateContextFromType(PointerBuffer properties, long device_type, CLErrorHandler pfn_notify, IntBuffer errcode_ret) { @@ -36,6 +39,9 @@ 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"); + long[] global = new long[1]; long ctx = this.clCreateContextFromType0( properties!=null?properties.getBuffer():null, Buffers.getDirectBufferByteOffset(properties), @@ -48,7 +54,7 @@ } return ctx; } - private native long clCreateContextFromType0(Object properties, int props_offset, long device_type, CLErrorHandler pfn_notify, long[] global, Object errcode_ret, int err_offset); + private native long clCreateContextFromType0(Object properties, int props_offset, long device_type, Object pfn_notify, long[] global, Object errcode_ret, int err_offset); public int clReleaseContext(long context) { diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index c904a37c..b200e3a5 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -159,7 +159,7 @@ public class CLContext extends CLObject implements CLResource { protected static long createContextFromType(CLErrorHandler handler, PointerBuffer properties, long deviceType) { - IntBuffer status = IntBuffer.allocate(1); + IntBuffer status = newDirectIntBuffer(1); long context = CLPlatform.getLowLevelCLInterface().clCreateContextFromType(properties, deviceType, handler, status); checkForError(status.get(), "can not create CL context"); |