if(count == 0) {
return new CLImageFormat[0];
}
CLImageFormat[] formats = new CLImageFormat[count];
CLImageFormatImpl impl = CLImageFormatImpl.create(newDirectByteBuffer(count * CLImageFormatImpl.size()));
ret = binding.clGetSupportedImageFormats(ID, flags, type, count, impl, null);
if(ret != CL_SUCCESS) {
throw newException(ret, "error calling clGetSupportedImageFormats");
}
ByteBuffer buffer = impl.getBuffer();
for (int i = 0; i < formats.length; i++) {
formats[i] = new CLImageFormat(CLImageFormatImpl.create(buffer.slice()));
buffer.position(i*CLImageFormatImpl.size());
}