device.setContext(this);
}
private CLImageFormat[] getSupportedImageFormats(int flags, int type) {
CLContextBinding binding = platform.getContextBinding();
int[] entries = new int[1];
int ret = binding.clGetSupportedImageFormats(ID, flags, type, 0, null, entries, 0);
if(ret != CL_SUCCESS) {
throw newException(ret, "error calling clGetSupportedImageFormats");
}
int count = entries[0];
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();