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);