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/javax/media/opengl/GLContext.java | 12 ++++-------- src/jogl/classes/javax/media/opengl/GLProfile.java | 4 ++-- src/jogl/classes/javax/media/opengl/awt/GLCanvas.java | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src/jogl/classes/javax') diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 34ac8e93b..45e1361fb 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -557,26 +557,22 @@ public abstract class GLContext { private static /*final*/ HashSet/**/ deviceVersionsAvailableSet = new HashSet(); protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctp) { - return getUniqueDeviceString(device) + "-" + toHexString(compose8bit(major, minor, ctp, 0)); + return device.getUniqueID() + "-" + toHexString(compose8bit(major, minor, ctp, 0)); } protected static String getDeviceVersionAvailableKey(AbstractGraphicsDevice device, int major, int profile) { - return getUniqueDeviceString(device) + "-" + toHexString(compose8bit(major, profile, 0, 0)); - } - - protected static String getUniqueDeviceString(AbstractGraphicsDevice device) { - return device.getType() + "_" + device.getConnection() ; + return device.getUniqueID() + "-" + toHexString(compose8bit(major, profile, 0, 0)); } protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { synchronized ( deviceVersionsAvailableSet ) { - return deviceVersionsAvailableSet.contains(getUniqueDeviceString(device)); + return deviceVersionsAvailableSet.contains(device.getUniqueID()); } } protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) { synchronized ( deviceVersionsAvailableSet ) { - String devKey = getUniqueDeviceString(device); + String devKey = device.getUniqueID(); if ( deviceVersionsAvailableSet.contains(devKey) ) { throw new InternalError("Already set: "+devKey); } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 4111eb5a2..878c4024e 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -1476,7 +1476,7 @@ public class GLProfile { if(null==device) { device = defaultDevice; } - String deviceKey = GLContext.getUniqueDeviceString(device); + String deviceKey = device.getUniqueID(); HashMap map = (HashMap) deviceConn2ProfileMap.get(deviceKey); if(null==map) { map = new HashMap(); @@ -1491,7 +1491,7 @@ public class GLProfile { private static void setProfileMap(AbstractGraphicsDevice device, HashMap/**/mappedProfiles) { validateInitialization(); synchronized ( deviceConn2ProfileMap ) { - deviceConn2ProfileMap.put(GLContext.getUniqueDeviceString(device), mappedProfiles); + deviceConn2ProfileMap.put(device.getUniqueID(), mappedProfiles); } } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index c0f2736fb..292bfba7c 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -779,7 +779,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable { return null; } - AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device); + AbstractGraphicsScreen aScreen = AWTGraphicsScreen.createScreenDevice(device, AbstractGraphicsDevice.DEFAULT_UNIT); AWTGraphicsConfiguration config = (AWTGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capabilities, chooser, -- cgit v1.2.3