From 35d1c40fe89311f88c7303930e172adcc5d6853a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 15 Nov 2010 03:53:22 +0100 Subject: NativeWindow AbstractGraphicsDevice: Add 'unitID' attribute and getUniqueID() Preparation to support multiple devices on one machine, hence adding the unitID a unique ID/index of the associated GPU, or GPU affinity. Adding getUniqueID() to return a cached semantic unique string id for the device. This was removed from the temp. impl in JOGL's GLContext, added unitID. All other changes just adapt to the above. --- src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java | 2 +- .../classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java | 8 ++------ .../jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java | 2 +- .../jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java | 8 ++------ .../jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java | 2 +- .../macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java | 4 ++-- .../jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java | 2 +- .../opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java | 2 +- .../jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java | 8 ++------ .../impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java | 4 ++-- .../wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java | 4 ++-- .../com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java | 4 ++-- .../impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java | 4 ++-- 13 files changed, 21 insertions(+), 33 deletions(-) (limited to 'src/jogl/classes/com/jogamp/opengl/impl') diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java index f9fcdb29c..81dcc12d5 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawable.java @@ -166,7 +166,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { if (!EGL.eglInitialize(eglDisplay, null, null)) { throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError())); } - EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay); + EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_UNIT); DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, aConfig.getScreen().getIndex()); GLCapabilities caps = (GLCapabilities) aConfig.getChosenCapabilities(); // yes, use the already choosen Capabilities (x11,win32,..) eglConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(e).chooseGraphicsConfiguration(caps, null, s); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java index c7e0a0417..3c8c4c98f 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLDrawableFactory.java @@ -95,11 +95,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { public EGLDrawableFactory() { super(); - /** FIXME: - * find out the Windows semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()} - * to actually use multiple devices. - */ - defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION); + defaultDevice = new EGLGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } static class SharedResource { @@ -174,7 +170,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } protected GLContext createExternalGLContextImpl() { - AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.EXTERNAL_CONNECTION, 0); + AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL); return new EGLExternalContext(absScreen); } diff --git a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java index 88e8a9ed1..c678707fc 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/egl/EGLGraphicsConfigurationFactory.java @@ -282,7 +282,7 @@ public class EGLGraphicsConfigurationFactory extends GraphicsConfigurationFactor if (!EGL.eglInitialize(eglDisplay, null, null)) { throw new GLException("eglInitialize failed"+", error 0x"+Integer.toHexString(EGL.eglGetError())); } - EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay); + EGLGraphicsDevice e = new EGLGraphicsDevice(eglDisplay, AbstractGraphicsDevice.DEFAULT_UNIT); DefaultGraphicsScreen s = new DefaultGraphicsScreen(e, 0); EGLGraphicsConfiguration eglConfig = chooseGraphicsConfigurationStatic(caps, chooser, s); if (null == eglConfig) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java index 7981e7ba2..a8a82b46a 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -86,11 +86,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } catch (JogampRuntimeException jre) { /* n/a .. */ } } - /** FIXME: - * find out the Windows semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()} - * to actually use multiple devices. - */ - defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION); + defaultDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } static class SharedResource { @@ -156,7 +152,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } protected NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { - AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(); + AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); ProxySurface ns = new ProxySurface(MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capabilities, chooser, screen, true)); ns.setSize(width, height); return ns; diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java index 973c67127..5dcc103b2 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/MacOSXExternalCGLContext.java @@ -97,7 +97,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { System.err.println("MacOSXExternalCGLContext Create "+caps); } - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(); + AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps, pixelFormat); ProxySurface ns = new ProxySurface(cfg); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java index 6a9617d27..af8841d3d 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java @@ -62,7 +62,7 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat } if(null==absScreen) { - absScreen = AWTGraphicsScreen.createScreenDevice(-1); + absScreen = AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT); } AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); @@ -83,7 +83,7 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GraphicsConfigurat long displayHandle = 0; - MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(); + MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex()); if(DEBUG) { System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: made "+macScreen); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java index 9917ea901..5ac937be8 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLContext.java @@ -75,7 +75,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat"); } - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(); + AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true); ProxySurface ns = new ProxySurface(cfg); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java index 19fe8f03c..ec0bd7c7a 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsExternalWGLDrawable.java @@ -61,7 +61,7 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat"); } - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(); + AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfiguration.create(hdc, pfdID, glp, aScreen, true, true); ProxySurface ns = new ProxySurface(cfg); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java index 850cf5542..64dd0eb46 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLDrawableFactory.java @@ -87,11 +87,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } catch (JogampRuntimeException jre) { /* n/a .. */ } } - /** FIXME: - * find out the Windows semantics of a device connection {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection()} - * to actually use multiple devices. - */ - defaultDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION); + defaultDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); } static class SharedResource { @@ -261,7 +257,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } protected final NativeSurface createOffscreenSurfaceImpl(GLCapabilities capabilities, GLCapabilitiesChooser chooser, int width, int height) { - AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(); + AbstractGraphicsScreen screen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); ProxySurface ns = new ProxySurface(WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic( capabilities, chooser, screen) ); ns.setSize(width, height); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index d34467fb1..372630446 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -65,7 +65,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio caps.setPBuffer (usePBuffer); if(null==absScreen) { - absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, 0); + absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); } return new WindowsWGLGraphicsConfiguration(absScreen, caps, caps, WindowsWGLGraphicsConfiguration.GLCapabilities2PFD(caps), -1, null); @@ -75,7 +75,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GraphicsConfiguratio CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { if(null==absScreen) { - absScreen = DefaultGraphicsScreen.createScreenDevice(AbstractGraphicsDevice.DEFAULT_CONNECTION, 0); + absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); } GLCapabilities caps2 = (GLCapabilities) caps.clone(); if(!caps2.isOnscreen()) { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java index 26704acf3..48850440d 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java @@ -62,7 +62,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura } if(null==absScreen) { - absScreen = AWTGraphicsScreen.createScreenDevice(-1); + absScreen = AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT); } AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); @@ -88,7 +88,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GraphicsConfigura long displayHandle = 0; - WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(); + WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex()); if(DEBUG) { System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: made "+winScreen); diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java index ddfae1f4c..d98d8a436 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/X11GLXDrawableFactory.java @@ -87,7 +87,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } catch (JogampRuntimeException jre) { /* n/a .. */ } } - defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName()); + defaultDevice = new X11GraphicsDevice(X11Util.getNullDisplayName(), AbstractGraphicsDevice.DEFAULT_UNIT); // Init shared resources via own thread // Will be released via ShutdownHook @@ -204,7 +204,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } private final SharedResource createSharedResource(String connection) { - X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.createDisplay(connection)); + X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.createDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT); sharedDevice.setCloseDisplay(true); X11Util.lockDefaultToolkit(sharedDevice.getHandle()); // OK try { diff --git a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java index 4b5b72cc6..d4af56aca 100644 --- a/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/impl/x11/glx/awt/X11AWTGLXGraphicsConfigurationFactory.java @@ -59,7 +59,7 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfiguration } if(null==absScreen) { - absScreen = AWTGraphicsScreen.createScreenDevice(-1); + absScreen = AWTGraphicsScreen.createScreenDevice(-1, AbstractGraphicsDevice.DEFAULT_UNIT); } AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); @@ -95,7 +95,7 @@ public class X11AWTGLXGraphicsConfigurationFactory extends GraphicsConfiguration displayHandle = X11Util.createDisplay(name); } ((AWTGraphicsDevice)awtScreen.getDevice()).setSubType(NativeWindowFactory.TYPE_X11, displayHandle); - X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle); + X11GraphicsDevice x11Device = new X11GraphicsDevice(displayHandle, AbstractGraphicsDevice.DEFAULT_UNIT); x11Device.setCloseDisplay(true); X11GraphicsScreen x11Screen = new X11GraphicsScreen(x11Device, awtScreen.getIndex()); if(DEBUG) { -- cgit v1.2.3