diff options
author | Sven Gothel <sgothel@jausoft.com> | 2011-11-18 19:22:11 +0100 |
---|---|---|
committer | Sven Gothel <sgothel@jausoft.com> | 2011-11-18 19:22:11 +0100 |
commit | cd609dc73fc7d7ecfc67670c57cfc7d90dff4eb8 (patch) | |
tree | f3c2ebcf8f1ea0e39b3067d10951c63dde7108b0 /src/jogl/classes/jogamp/opengl | |
parent | 2b4318da81b2ce97b7f7291f423053d9d4a46eca (diff) |
WindowsWGLDrawableFactory createOffscreenDrawable() - Don't spin off creation on AWT thread (may deadlock)
Diffstat (limited to 'src/jogl/classes/jogamp/opengl')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java | 9 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java | 35 |
2 files changed, 17 insertions, 27 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index 4f0b11789..068190cb2 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -323,15 +323,6 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // GLDrawableFactoryImpl details // - protected void maybeDoSingleThreadedWorkaround(Runnable action) { - if (Threading.isSingleThreaded() && - !Threading.isOpenGLThread()) { - Threading.invokeOnOpenGLThread(action); - } else { - action.run(); - } - } - /** * Returns the sole GLDrawableFactoryImpl instance. * diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 772dbbd00..5a1f997a6 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -436,33 +436,32 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } // PBuffer GLDrawable Creation + GLDrawableImpl pbufferDrawable; final AbstractGraphicsDevice device = config.getScreen().getDevice(); + /** + * Similar to ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277, + * we need to have a context current on the same Display to create a PBuffer. + */ final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); - if(null==sr) { - throw new IllegalArgumentException("No shared resource for "+device); - } - final List<GLDrawableImpl> returnList = new ArrayList<GLDrawableImpl>(); - Runnable r = new Runnable() { - public void run() { - GLContext lastContext = GLContext.getCurrent(); - if (lastContext != null) { + if(null!=sr) { + GLContext lastContext = GLContext.getCurrent(); + if (lastContext != null) { lastContext.release(); - } - sr.context.makeCurrent(); - try { - GLDrawableImpl pbufferDrawable = new WindowsPbufferWGLDrawable(WindowsWGLDrawableFactory.this, target); - returnList.add(pbufferDrawable); - } finally { + } + sr.context.makeCurrent(); + try { + pbufferDrawable = new WindowsPbufferWGLDrawable(WindowsWGLDrawableFactory.this, target); + } finally { sr.context.release(); if (lastContext != null) { lastContext.makeCurrent(); } - } } - }; - maybeDoSingleThreadedWorkaround(r); - return returnList.get(0); + } else { + pbufferDrawable = new WindowsPbufferWGLDrawable(WindowsWGLDrawableFactory.this, target); + } + return pbufferDrawable; } /** |