aboutsummaryrefslogtreecommitdiffstats
path: root/src/jogl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-10-08 08:16:10 +0200
committerSven Gothel <[email protected]>2014-10-08 08:16:10 +0200
commit73654365e6147a5eabe8747e5f4802b1fba83829 (patch)
tree300e2895e8419252ca72314fa5774b8bed2d5152 /src/jogl
parent5d3b7dc83c04e2c626a635eb3d143710f7ef4db2 (diff)
Bug 1088: Add GLRendererQuirks.NeedSharedObjectSync; Tests: Synchronize GL objects if GLRendererQuirks.NeedSharedObjectSync is set.
GLSharedContextSetter#synchronization GL Object Synchronization Usually synchronization of shared GL objects should not be required, if the shared GL objects are created and immutable before concurrent usage. However, using drivers exposing GLRendererQuirks.NeedSharedObjectSync always require the user to synchronize access of shared GL objects. Synchronization can be avoided if accessing the shared GL objects exclusively via a queue or com.jogamp.common.util.Ringbuffer, see GLMediaPlayerImpl as an example. +++ GLRendererQuirks.NeedSharedObjectSync is set for all OSX versions +++ Handle GLRendererQuirks.NeedSharedObjectSync in user code! +++ All shared context tests passed on OSX 10.9.5, and GNU/Linux w/ Nvidia + Mesa/AMD driver.
Diffstat (limited to 'src/jogl')
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java37
-rw-r--r--src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java16
-rw-r--r--src/jogl/classes/jogamp/opengl/GLContextImpl.java7
3 files changed, 58 insertions, 2 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
index b1bc8828b..7b5e6b8f1 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java
@@ -363,8 +363,40 @@ public class GLRendererQuirks {
*/
public static final int NoPBufferWithAccum = 19;
+ /**
+ * Need GL objects (VBO, ..) to be synchronized when utilized
+ * concurrently from multiple threads via a shared GL context,
+ * otherwise driver crashes the VM.
+ * <p>
+ * Usually synchronization should not be required, if the shared GL objects
+ * are created and immutable before concurrent usage.<br>
+ * However, using drivers exposing this issue always require the user to
+ * synchronize access of shared GL objects.
+ * </p>
+ * <p>
+ * Synchronization can be avoided if accessing the shared GL objects
+ * exclusively via a queue or {@link com.jogamp.common.util.Ringbuffer Ringbuffer}, see GLMediaPlayerImpl as an example.
+ * </p>
+ * <p>
+ * Appears on:
+ * <ul>
+ * <li>Platform OSX
+ * <ul>
+ * <li>detected on OSX 10.9.5 first</li>
+ * <li>any driver</li>
+ * <li>enabled for all OSX versions</li>
+ * </ul>
+ * </li>
+ * </ul>
+ * </p>
+ * <p>
+ * See Bug 1088 - https://jogamp.org/bugzilla/show_bug.cgi?id=1088
+ * </p>
+ */
+ public static final int NeedSharedObjectSync = 20;
+
/** Return the number of known quirks. */
- public static final int getCount() { return 20; }
+ public static final int getCount() { return 21; }
private static final String[] _names = new String[] { "NoDoubleBufferedPBuffer", "NoDoubleBufferedBitmap", "NoSetSwapInterval",
"NoOffscreenBitmap", "NoSetSwapIntervalPostRetarget", "GLSLBuggyDiscard",
@@ -372,7 +404,8 @@ public class GLRendererQuirks {
"NeedCurrCtx4ARBPixFmtQueries", "NeedCurrCtx4ARBCreateContext",
"NoFullFBOSupport", "GLSLNonCompliant", "GL4NeedsGL3Request",
"GLSharedContextBuggy", "GLES3ViaEGLES2Config", "SingletonEGLDisplayOnly",
- "NoMultiSamplingBuffers", "BuggyColorRenderbuffer", "NoPBufferWithAccum"
+ "NoMultiSamplingBuffers", "BuggyColorRenderbuffer", "NoPBufferWithAccum",
+ "NeedSharedObjectSync"
};
private static final IdentityHashMap<String, GLRendererQuirks> stickyDeviceQuirks = new IdentityHashMap<String, GLRendererQuirks>();
diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
index 526967d69..b8aef126b 100644
--- a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
+++ b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java
@@ -28,6 +28,8 @@
package javax.media.opengl;
+import com.jogamp.opengl.GLRendererQuirks;
+
/**
* Adds capabilities to set a shared {@link GLContext} directly or via an {@link GLAutoDrawable}.
* <p>
@@ -88,6 +90,20 @@ package javax.media.opengl;
glad.setVisible(true); // GLWindow creation ..
* </pre>
* </p>
+ * <h5><a name="synchronization">GL Object Synchronization</a></h5>
+ * <p>
+ * Usually synchronization of shared GL objects should not be required, if the shared GL objects
+ * are created and immutable before concurrent usage.
+ * </p>
+ * <p>
+ * However, using drivers exposing {@link GLRendererQuirks#NeedSharedObjectSync} always
+ * require the user to synchronize access of shared GL objects.
+ * </p>
+ * <p>
+ * Synchronization can be avoided if accessing the shared GL objects
+ * exclusively via a queue or {@link com.jogamp.common.util.Ringbuffer Ringbuffer}, see GLMediaPlayerImpl as an example.
+ * </p>
+ * </p>
* <h5><a name="driverissues">Known Driver Issues</a></h5>
* <h7><a name="intelmesa">Intel's Mesa >= 9.1.2 Backend for [Sandybridge/Ivybridge] on GNU/Linux</a></h7>
* <p>
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index bc8d3b7e4..45a4f2426 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -1785,6 +1785,13 @@ public abstract class GLContextImpl extends GLContext {
}
quirks.addQuirk( quirk );
}
+ {
+ final int quirk = GLRendererQuirks.NeedSharedObjectSync;
+ if(DEBUG) {
+ System.err.println("Quirk: "+GLRendererQuirks.toString(quirk)+": cause: OS "+Platform.getOSType());
+ }
+ quirks.addQuirk( quirk );
+ }
if( Platform.getOSVersionNumber().compareTo(Platform.OSXVersion.Mavericks) >= 0 && 3==reqMajor && 4==major ) {
final int quirk = GLRendererQuirks.GL4NeedsGL3Request;
if(DEBUG) {