[FIXED] OpenCL and OpenGL interop for the Mac, patch here.

Started by jaekwon, March 28, 2011, 05:19:22

Previous topic - Next topic

jaekwon

I think it is since Snow Leopard 10.6 that CL/GL interop has been available on the Mac. Unfortunately this feature doesn't work with LWJGL, so I patched the code for my personal use.

Attached here is a patch that will compile a jnilib for the mac for Snow Leopard. I'm not sure how to proceed with patching the rest of the project with build flags / compile time flags for the master branch, considering that LWJGL supports older versions of macosx, while this patch requires Snow Leopard; perhaps someone else can chime in.

I also have a demo of CL/GL interop written in Scala, if anybody is interested in seeing that I will write a blog post about it.

Matzon

patch looks good. Not sure about the 1.6 requirements since the build farm is 1.5 ...

I know that kappa is going to need some 1.6 features too  - so something will change down the line ...

kappa

Using the 10.6 sdk to access new API's should be fine (once the nightly server is updated or something), however we should still set the build target to at least OS X 10.4 (in the build file). This is mainly because the OS X 10.4 and 10.5 user base is still very significant. OS X 10.3 can be dropped safely though as Java 1.5 was never released on there and is now a minimum requirement for LWJGL.

The patch does look good but could use a slight tweak to check if the code is running on OS X 10.6+ and only use new API if so (or throw an error if user requested such features on older OS X) this will allow us to keep the minimum target to at least OS X 10.4 and still have the functionality.

Matzon

kappa, apply patch now - or wait for

Quote
The patch does look good but could use a slight tweak to check if the code is running on OS X 10.6+ and only use new API if so (or throw an error if user requested such features on older OS X) this will allow us to keep the minimum target to at least OS X 10.4 and still have the functionality.
?

kappa

I think this patch is good to go now after the recent Mac OS X changes.

From what I can see of the patch now (at a glance) are the following observations:

1) The diff to build.xml isn't needed anymore as that file has already been changed as needed.

2) The file Context.java no longer contains the targeted diff code as that has been moved to ContextGL.java so those changes can go in there.

3) The code changes in the diff to the method setCLSharingProperties() in Context.java/ContexGL.java, will run the code on any mac, however the patch is only support on OS X 10.6+ so we need a LWJGLUtil.isMacOSXEqualsOrBetterThan(10, 6) in there somewhere which throws a unsupported error on anything lower than 10.6.

4) The LWJGL line in ContextGL.java
throw new UnsupportedOperationException("CL/GL context sharing is not supposed on this platform.");
has a typo and should read "is not supported" :)

Anyone have any other observations?

kappa