public List<CLImageFormat> getSupportedImageFormats(final CLContext context, final long flags, final int image_type, final Filter<CLImageFormat> filter) { final IntBuffer numBuffer = APIUtil.getBufferInt(); clGetSupportedImageFormats(context, flags, image_type, null, numBuffer); final int num_image_formats = numBuffer.get(0); if ( num_image_formats == 0 ) return null; final ByteBuffer formatBuffer = BufferUtils.createByteBuffer(num_image_formats * CLImageFormat.STRUCT_SIZE); clGetSupportedImageFormats(context, flags, image_type, formatBuffer, null); final List<CLImageFormat> formats = new ArrayList<CLImageFormat>(num_image_formats); for ( int i = 0; i < num_image_formats; i++ ) { final int offset = num_image_formats * CLImageFormat.STRUCT_SIZE; final CLImageFormat format = new CLImageFormat( formatBuffer.getInt(offset), formatBuffer.getInt(offset + 4) ); if ( filter == null || filter.accept(format) ) formats.add(format); } return formats.size() == 0 ? null : formats; }
public CLMem createImage2D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_row_pitch, final Buffer host_ptr, IntBuffer errcode_ret) { final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4); formatBuffer.putInt(0, image_format.getChannelOrder()); formatBuffer.putInt(4, image_format.getChannelType()); final long function_pointer = CLCapabilities.clCreateImage2D; BufferChecks.checkFunctionAddress(function_pointer); if ( errcode_ret != null ) BufferChecks.checkBuffer(errcode_ret, 1); else if ( LWJGLUtil.DEBUG ) errcode_ret = APIUtil.getBufferInt(); CLMem __result = new CLMem(nclCreateImage2D(context.getPointer(), flags, MemoryUtil.getAddress(formatBuffer, 0), image_width, image_height, image_row_pitch, MemoryUtil.getAddress0Safe(host_ptr) + (host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage2DSize(formatBuffer, image_width, image_height, image_row_pitch)) : 0), MemoryUtil.getAddressSafe(errcode_ret), function_pointer), context); if ( LWJGLUtil.DEBUG ) Util.checkCLError(errcode_ret.get(0)); return __result; }
public CLMem createImage3D(final CLContext context, final long flags, final CLImageFormat image_format, final long image_width, final long image_height, final long image_depth, final long image_row_pitch, final long image_slice_pitch, final Buffer host_ptr, IntBuffer errcode_ret) { final ByteBuffer formatBuffer = APIUtil.getBufferByte(2 * 4); formatBuffer.putInt(0, image_format.getChannelOrder()); formatBuffer.putInt(4, image_format.getChannelType()); final long function_pointer = CLCapabilities.clCreateImage3D; BufferChecks.checkFunctionAddress(function_pointer); if ( errcode_ret != null ) BufferChecks.checkBuffer(errcode_ret, 1); else if ( LWJGLUtil.DEBUG ) errcode_ret = APIUtil.getBufferInt(); CLMem __result = new CLMem(nclCreateImage3D(context.getPointer(), flags, MemoryUtil.getAddress(formatBuffer, 0), image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, MemoryUtil.getAddress0Safe(host_ptr) + (host_ptr != null ? BufferChecks.checkBuffer(host_ptr, CLChecks.calculateImage3DSize(formatBuffer, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch)) : 0), MemoryUtil.getAddressSafe(errcode_ret), function_pointer), context); if ( LWJGLUtil.DEBUG ) Util.checkCLError(errcode_ret.get(0)); return __result; }
public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type) { return getSupportedImageFormats(flags, image_type, null); }
public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type, final Filter<CLImageFormat> filter) { return util.getSupportedImageFormats(this, flags, image_type, filter); }
public CLImageFormat getImageInfoFormat(final CLMem mem) { mem.checkValid(); final ByteBuffer format = APIUtil.getBufferByte(2 * 4); clGetImageInfo(mem, CL_IMAGE_FORMAT, format, null); return new CLImageFormat(format.getInt(0), format.getInt(4)); }