From bde835213c584393d4be4ec7da62e7efd49430b7 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 31 Oct 2013 13:12:10 +0100 Subject: GLDrawableFactory: createDummy*(..) Pass GLCapabilitiesImmutable + GLCapabilitiesChooser instead of GLProfile, allowing using same or similar caps - important for sharing ctx --- .../javax/media/opengl/GLDrawableFactory.java | 19 ++++++++++++------ .../javax/media/opengl/GLSharedContextSetter.java | 23 ++++++++++++++++++++-- 2 files changed, 34 insertions(+), 8 deletions(-) (limited to 'src/jogl/classes/javax/media') diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 3e53a1819..2af4ba306 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -561,7 +561,7 @@ public abstract class GLDrawableFactory { /** * Creates a {@link GLDrawable#isRealized() realized} dummy {@link GLAutoDrawable} * incl it's dummy, invisible {@link NativeSurface} - * as created with {@link #createDummyDrawable(AbstractGraphicsDevice, boolean, GLProfile)}. + * as created with {@link #createDummyDrawable(AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser)}. *

* The dummy {@link GLAutoDrawable}'s {@link GLDrawable} is {@link GLDrawable#isRealized() realized} * without an assigned {@link GLContext}, hence not initialized completely.
@@ -574,12 +574,15 @@ public abstract class GLDrawableFactory { * * @param deviceReq which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be null for the platform's default device. * @param createNewDevice if true a new independent device instance is created from the deviceReq, otherwise deviceReq is used as-is and must be valid! - * @param glp the desired {@link GLProfile} + * @param capsRequested the desired {@link GLCapabilitiesImmutable}, incl. it's {@link GLProfile}. + * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType)} + * across shared drawables will yield best compatibility. + * @param chooser the custom chooser, may be null for default * @return the created and realized dummy {@link GLAutoDrawable} instance * - * @see #createDummyDrawable(AbstractGraphicsDevice, boolean, GLProfile) + * @see #createDummyDrawable(AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser) */ - public abstract GLAutoDrawable createDummyAutoDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLProfile glp); + public abstract GLAutoDrawable createDummyAutoDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser); /** * Creates an {@link GLDrawable#isRealized() unrealized} offscreen {@link GLDrawable} @@ -629,10 +632,14 @@ public abstract class GLDrawableFactory { *

* @param deviceReq which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be null for the platform's default device. * @param createNewDevice if true a new independent device instance is created from the deviceReq, otherwise deviceReq is used as-is and must be valid! - * @param glp the desired {@link GLProfile} + * @param capsRequested the desired {@link GLCapabilitiesImmutable}, incl. it's {@link GLProfile}. + * For shared context, same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType) visual ID} + * or {@link GLCapabilitiesImmutable caps} + * across shared drawables will yield best compatibility. + * @param chooser the custom chooser, may be null for default * @return the created unrealized dummy {@link GLDrawable} */ - public abstract GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLProfile glp); + public abstract GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser); /** * Creates a proxy {@link NativeSurface} w/ defined surface handle, diff --git a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java index 873e4cd9f..78dd693cb 100644 --- a/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java +++ b/src/jogl/classes/javax/media/opengl/GLSharedContextSetter.java @@ -39,6 +39,10 @@ package javax.media.opengl; * shared {@link GLContext} w/ this master are referred as slave {@link GLContext} * and controls the shared object's lifecycle, i.e. their construction and destruction. *

+ *

+ * Using the nearest or same {@link GLCapabilitiesImmutable#getVisualID(javax.media.nativewindow.VisualIDHolder.VIDType) visual ID} + * or {@link GLCapabilitiesImmutable caps} across the shared {@link GLDrawable}s will yield best compatibility. + *

*
Lifecycle Considerations
*

* After shared objects are created on the master, the OpenGL pipeline @@ -56,7 +60,7 @@ package javax.media.opengl; * or the slaves validate whether the resources are still valid. *

*

- * To simplify above lifecycle issues, one may use a {@link GLDrawableFactory#createDummyDrawable(javax.media.nativewindow.AbstractGraphicsDevice, boolean, GLProfile) dummy} + * To simplify above lifecycle issues, one may use a {@link GLDrawableFactory#createDummyDrawable(javax.media.nativewindow.AbstractGraphicsDevice, boolean, GLCapabilitiesImmutable, GLCapabilitiesChooser) dummy} * {@link GLDrawable} and it's {@link GLContext} as the master of all shared slave {@link GLContext}. * Since this dummy instance does not depend on any native windowing system, it can be controlled easily w/o being in sight.
* Below code creates a {@link GLAutoDrawable} based on a dummy GLDrawable: @@ -66,7 +70,7 @@ package javax.media.opengl; final GLProfile glp = caps.getGLProfile(); .. final boolean createNewDevice = true; // use 'own' display device! - final GLAutoDrawable sharedDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, createNewDevice, glp); + final GLAutoDrawable sharedDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, createNewDevice, caps, null); sharedDrawable.display(); // triggers GLContext object creation and native realization. ... // Later a shared 'slave' can be created e.g.: @@ -76,6 +80,21 @@ package javax.media.opengl; glad.setVisible(true); // GLWindow creation .. * *

+ *
Known Driver Issues
+ * Intel's Mesa >= 9.1.2 Backend for [Sandybridge/Ivybridge] on GNU/Linux + *

+ *

+ * Error: 'intel_do_flush_locked: No such file or directory'
+ * JogAmp: 
+ * freedesktop.org: 
+ * 
+ * Shared context seems not to be supported w/ lock-free bound X11 display connections + * per OpenGL drawable/context. The error message above is thrown in this case. + * Hence the driver bug renders shared context use w/ JOGL impossible. + *

+ * Hisilicon's Immersion.16 + *

+ *

*/ public interface GLSharedContextSetter extends GLAutoDrawable { /** -- cgit v1.2.3