예제 #1
0
 public static CLMem clCreateSubBuffer(
     CLMem buffer,
     long flags,
     int buffer_create_type,
     ByteBuffer buffer_create_info,
     IntBuffer errcode_ret) {
   long function_pointer = CLCapabilities.clCreateSubBuffer;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkBuffer(buffer_create_info, 2 * PointerBuffer.getPointerSize());
   if (errcode_ret != null) BufferChecks.checkBuffer(errcode_ret, 1);
   CLMem __result =
       CLMem.create(
           nclCreateSubBuffer(
               buffer.getPointer(),
               flags,
               buffer_create_type,
               MemoryUtil.getAddress(buffer_create_info),
               MemoryUtil.getAddressSafe(errcode_ret),
               function_pointer),
           buffer.getParent());
   return __result;
 }
예제 #2
0
 public static int clEnqueueCopyBufferRect(
     CLCommandQueue command_queue,
     CLMem src_buffer,
     CLMem dst_buffer,
     PointerBuffer src_origin,
     PointerBuffer dst_origin,
     PointerBuffer region,
     long src_row_pitch,
     long src_slice_pitch,
     long dst_row_pitch,
     long dst_slice_pitch,
     PointerBuffer event_wait_list,
     PointerBuffer event) {
   long function_pointer = CLCapabilities.clEnqueueCopyBufferRect;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkBuffer(src_origin, 3);
   BufferChecks.checkBuffer(dst_origin, 3);
   BufferChecks.checkBuffer(region, 3);
   if (event_wait_list != null) BufferChecks.checkDirect(event_wait_list);
   if (event != null) BufferChecks.checkBuffer(event, 1);
   int __result =
       nclEnqueueCopyBufferRect(
           command_queue.getPointer(),
           src_buffer.getPointer(),
           dst_buffer.getPointer(),
           MemoryUtil.getAddress(src_origin),
           MemoryUtil.getAddress(dst_origin),
           MemoryUtil.getAddress(region),
           src_row_pitch,
           src_slice_pitch,
           dst_row_pitch,
           dst_slice_pitch,
           (event_wait_list == null ? 0 : event_wait_list.remaining()),
           MemoryUtil.getAddressSafe(event_wait_list),
           MemoryUtil.getAddressSafe(event),
           function_pointer);
   if (__result == CL10.CL_SUCCESS) command_queue.registerCLEvent(event);
   return __result;
 }
예제 #3
0
 public static int clSetMemObjectDestructorCallback(
     CLMem memobj, CLMemObjectDestructorCallback pfn_notify) {
   long function_pointer = CLCapabilities.clSetMemObjectDestructorCallback;
   BufferChecks.checkFunctionAddress(function_pointer);
   long user_data = CallbackUtil.createGlobalRef(pfn_notify);
   int __result = 0;
   try {
     __result =
         nclSetMemObjectDestructorCallback(
             memobj.getPointer(), pfn_notify.getPointer(), user_data, function_pointer);
     return __result;
   } finally {
     CallbackUtil.checkCallback(__result, user_data);
   }
 }
예제 #4
0
 public static int clEnqueueWriteBufferRect(
     CLCommandQueue command_queue,
     CLMem buffer,
     int blocking_write,
     PointerBuffer buffer_offset,
     PointerBuffer host_offset,
     PointerBuffer region,
     long buffer_row_pitch,
     long buffer_slice_pitch,
     long host_row_pitch,
     long host_slice_pitch,
     ShortBuffer ptr,
     PointerBuffer event_wait_list,
     PointerBuffer event) {
   long function_pointer = CLCapabilities.clEnqueueWriteBufferRect;
   BufferChecks.checkFunctionAddress(function_pointer);
   BufferChecks.checkBuffer(buffer_offset, 3);
   BufferChecks.checkBuffer(host_offset, 3);
   BufferChecks.checkBuffer(region, 3);
   BufferChecks.checkBuffer(
       ptr,
       CLChecks.calculateBufferRectSize(host_offset, region, host_row_pitch, host_slice_pitch));
   if (event_wait_list != null) BufferChecks.checkDirect(event_wait_list);
   if (event != null) BufferChecks.checkBuffer(event, 1);
   int __result =
       nclEnqueueWriteBufferRect(
           command_queue.getPointer(),
           buffer.getPointer(),
           blocking_write,
           MemoryUtil.getAddress(buffer_offset),
           MemoryUtil.getAddress(host_offset),
           MemoryUtil.getAddress(region),
           buffer_row_pitch,
           buffer_slice_pitch,
           host_row_pitch,
           host_slice_pitch,
           MemoryUtil.getAddress(ptr),
           (event_wait_list == null ? 0 : event_wait_list.remaining()),
           MemoryUtil.getAddressSafe(event_wait_list),
           MemoryUtil.getAddressSafe(event),
           function_pointer);
   if (__result == CL10.CL_SUCCESS) command_queue.registerCLEvent(event);
   return __result;
 }