LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: Lobo on November 29, 2016, 16:44:16

Title: OpenCL changes from 3.0 to 3.1.1
Post by: Lobo on November 29, 2016, 16:44:16
Hey,

I tried to upgrade my system from LWJGL 3.0 to 3.1.1, because I want some missing glfw functions.
Now I get several compiling errors because the OpenCL classes have changed/removed for example these classes are gone:


org.lwjgl.opencl.CLDevice;
org.lwjgl.opencl.CLPlatform;
org.lwjgl.opencl.Info;


I used them to get the Platform and Device names for CL computation, see here:


public static String[] getPlatformNames()
{
ArrayList<String> platformNames = new ArrayList<>(0);
CLPlatform.getPlatforms().forEach(element -> platformNames.add(getPlatformInfo(element, CL10.CL_PLATFORM_VENDOR).trim()));
return platformNames.toArray(new String[platformNames.size()]);
}

public static String[] getDeviceNames(int index)
{
ArrayList<String> deviceNames = new ArrayList<>(0);
CLPlatform.getPlatforms().get(index).getDevices(CL10.CL_DEVICE_TYPE_ALL).forEach(element -> deviceNames.add(getDeviceInfo(element, CL10.CL_DEVICE_NAME).trim()));
return deviceNames.toArray(new String[deviceNames.size()]);
}

private static String getPlatformInfo(CLPlatform platform, int param) {
return Info.clGetPlatformInfoStringUTF8(platform.address(), param);
}

private static String getDeviceInfo(CLDevice device, int param) {
return Info.clGetDeviceInfoStringUTF8(device.address(), param);
}


Now this seems not to be possible anymore, is there a tutorial or something available how I can change opencl from lwjgl 3.0 to 3.1.1?

Would be great if someone could help.

Thanks a lot.
Title: Re: OpenCL changes from 3.0 to 3.1.1
Post by: spasi on November 29, 2016, 18:08:17
These classes were removed before 3.0.0 was released. You were probably using the alpha or beta version.

The (quite limited) functionality offered by those classes can be replicated very easily. See the OpenCL demos (https://github.com/LWJGL/lwjgl3/tree/master/modules/core/src/test/java/org/lwjgl/demo/opencl) and the InfoUtil (https://github.com/LWJGL/lwjgl3/blob/master/modules/core/src/test/java/org/lwjgl/opencl/InfoUtil.java) class for example code.
Title: Re: OpenCL changes from 3.0 to 3.1.1
Post by: Lobo on November 29, 2016, 18:13:20
oh ok thanks, yes could be that it was a 3.0 beta.

Perfect this will help me to upgrade it thanks a lot.