Hello Guest

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

  • 5 Replies
  • 6815 Views
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.
« Last Edit: March 28, 2011, 05:21:11 by jaekwon »

*

Offline Matzon

  • *****
  • 2242
Re: OpenCL and OpenGL interop for the Mac, patch here.
« Reply #1 on: March 28, 2011, 06:49:08 »
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 ...

*

Offline kappa

  • *****
  • 1314
Re: OpenCL and OpenGL interop for the Mac, patch here.
« Reply #2 on: March 28, 2011, 10:09:27 »
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.
« Last Edit: March 28, 2011, 11:07:32 by kappa »

*

Offline Matzon

  • *****
  • 2242
Re: [RFE] OpenCL and OpenGL interop for the Mac, patch here.
« Reply #3 on: April 16, 2011, 18:42:29 »
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.
?

*

Offline kappa

  • *****
  • 1314
Re: [RFE] OpenCL and OpenGL interop for the Mac, patch here.
« Reply #4 on: September 23, 2011, 11:53:14 »
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
Code: [Select]
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?

*

Offline kappa

  • *****
  • 1314
Re: [RFE] OpenCL and OpenGL interop for the Mac, patch here.
« Reply #5 on: October 06, 2011, 21:08:42 »
patch has now been committed.