From 618f6380b6eb6a96f8f1829c1dfb621a71209711 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 29 Aug 2015 03:54:47 +0200 Subject: Bug 1203: SharedResourceRunner.Implementation impl. shall use AbstractGraphicsDevice's uniqueID instead of connection AbstractGraphicsDevice's uniqueID supports multiple device types and units while including the connection. This is required for proper EGLDrawableFactory's profile probing on different native platform devices. Using common abstract implementation 'AImplementation' for WindowsWGL's, X11GLX's and EGL's DrawableFactory. --- .../opengl/x11/glx/X11GLXDrawableFactory.java | 34 +++++----------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'src/jogl/classes/jogamp/opengl/x11') diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index ecaf20d86..d825309ee 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -41,8 +41,6 @@ import java.nio.Buffer; import java.nio.ShortBuffer; import java.security.AccessController; import java.security.PrivilegedAction; -import java.util.Collection; -import java.util.HashMap; import java.util.List; import com.jogamp.nativewindow.AbstractGraphicsConfiguration; @@ -126,11 +124,10 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { // The act of constructing them causes them to be registered X11GLXGraphicsConfigurationFactory.registerFactory(); - sharedMap = new HashMap(); - // Init shared resources off thread // Will be released via ShutdownHook - sharedResourceRunner = new SharedResourceRunner(new SharedResourceImplementation()); + sharedResourceImplementation = new SharedResourceImplementation(); + sharedResourceRunner = new SharedResourceRunner(sharedResourceImplementation); sharedResourceRunner.start(); } } @@ -149,9 +146,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { sharedResourceRunner.stop(); sharedResourceRunner = null; } - if(null != sharedMap) { - sharedMap.clear(); - sharedMap = null; + if(null != sharedResourceImplementation) { + sharedResourceImplementation.clear(); + sharedResourceImplementation = null; } defaultDevice = null; /** @@ -168,8 +165,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } private X11GraphicsDevice defaultDevice; + private SharedResourceImplementation sharedResourceImplementation; private SharedResourceRunner sharedResourceRunner; - private HashMap sharedMap; static class SharedResource implements SharedResourceRunner.Resource { private final String glXServerVendorName; @@ -226,24 +223,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { final boolean isGLXMultisampleAvailable() { return glXMultisampleAvailable; } } - class SharedResourceImplementation implements SharedResourceRunner.Implementation { - @Override - public void clear() { - sharedMap.clear(); - } - @Override - public SharedResourceRunner.Resource mapPut(final AbstractGraphicsDevice device, final SharedResourceRunner.Resource resource) { - return sharedMap.put(device.getConnection(), resource); - } - @Override - public SharedResourceRunner.Resource mapGet(final AbstractGraphicsDevice device) { - return sharedMap.get(device.getConnection()); - } - @Override - public Collection mapValues() { - return sharedMap.values(); - } - + class SharedResourceImplementation extends SharedResourceRunner.AImplementation { @Override public boolean isDeviceSupported(final AbstractGraphicsDevice device) { final boolean res; -- cgit v1.2.3