tuskiomi
tuskiomi

Reputation: 190

In LWJGL's OpenCL capabilities where do I derive "cl_platform_id" from?

Taking a look at the LWJGL docs for their OpenCL port, one can see that in order to create the OpenCL capabilities using the method createPlatfromCapabilities in the CL.class class, you'll need to pass in a long cl_platform_id. Where is this derived?

I've tried passing in Platform.WINDOWS, as seen below: enter image description here
However, there is no field in Platform.WINDOWS that will yield a long.

Considering the variable is named "platform" ID, I imagine it's not asking for a window long that LWJGL normally issues, and because "CL" is also in the name, I assume that It's also issued by one of the internal OpenCL classes.

I've searched the docs extensively, and "cl_platform_id" only appears in that method. The docs simply say the following:

"@param cl_platform_id: the platform to query"

Gee. that helps a lot.

What does the cl_platform_id parameter in the createPlatfromCapabilities method signify, and where would I find it?

Upvotes: 0

Views: 66

Answers (1)

apetranzilla
apetranzilla

Reputation: 5959

You need to use a platform ID obtained from clGetPlatformIDs. The first parameter is a buffer to store the IDs in (or null) and the second parameter is a buffer to store the number of IDs read (or null). You'll want to call the function once passing null for the first parameter and a 1-item IntBuffer for the second, then use the int stored in the buffer to allocate a PointerBuffer and call it again to actually read the IDs.

Upvotes: 1

Related Questions