diff options
author | Sven Gothel <[email protected]> | 2023-03-04 05:08:07 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-03-04 05:08:07 +0100 |
commit | 09f0018363778a6cbf594bc2bf71d899d36e3c46 (patch) | |
tree | 640bcf3ceb87bca6213934a434df4f99a77b2e35 /src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java | |
parent | 64e741cbdcc0cc22f5b59fca01fa031879eff68c (diff) |
GLDrawableFactoryImpl:createDummySurfaceImpl() and createSurfacelessImpl(): Pass orig AbstractGraphicsDevice to allow EGLDrawableFactory to use the original device's native-dislay-ID for sharing resources.
EGLDrawableFactory to use the original device's native-dislay-ID for sharing resources, e.g. GLContext.
EGL 1.4 requires same native-display-ID of share-list context and newly created context!
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index 85482679b..3177915dd 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -260,7 +260,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } final GLCapabilitiesImmutable caps = new GLCapabilities(glp); - final GLDrawableImpl drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, false, caps, caps, null, 64, 64)); + final GLDrawableImpl drawable = createOnscreenDrawableImpl(createDummySurfaceImpl(device, device, false, caps, caps, null, 64, 64)); drawable.setRealized(true); final X11GLCapabilities chosenCaps = (X11GLCapabilities) drawable.getChosenGLCapabilities(); final boolean glxForcedOneOne = !chosenCaps.hasFBConfig(); @@ -522,31 +522,34 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final X11GraphicsDevice device; + final boolean owning; if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) { device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); + owning = true; } else { device = (X11GraphicsDevice) deviceReq; + owning = false; } final X11GraphicsScreen screen = new X11GraphicsScreen(device, device.getDefaultScreen()); final X11GLXGraphicsConfiguration config = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsChosen, capsRequested, chooser, screen, VisualIDHolder.VID_UNDEFINED); if(null == config) { throw new GLException("Choosing GraphicsConfiguration failed w/ "+capsChosen+" on "+screen); } - return new WrappedSurface(config, 0, upstreamHook, createNewDevice); + return new WrappedSurface(config, 0, upstreamHook, owning); } @Override - public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceOrig, final AbstractGraphicsDevice device, + final boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); - return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height)); + return createMutableSurfaceImpl(device, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height)); } @Override - public final ProxySurface createSurfacelessImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { + public final ProxySurface createSurfacelessImpl(AbstractGraphicsDevice deviceOrig, final AbstractGraphicsDevice device, + final boolean createNewDevice, GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); - return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height)); + return createMutableSurfaceImpl(device, createNewDevice, chosenCaps, requestedCaps, chooser, new GenericUpstreamSurfacelessHook(width, height)); } @Override |