diff options
author | Sven Gothel <[email protected]> | 2012-09-28 18:59:11 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-09-28 18:59:11 +0200 |
commit | 27fe889023c7366e264647e5dc25053f22df0956 (patch) | |
tree | 102cec7585b32bf0f741918757acba3dc38404ab /src/jogl/classes/javax/media/opengl/GLContext.java | |
parent | 30d6d5e3c1ee7132c2b3cc722839528882e03053 (diff) |
Adding Mesa Quirk 'NoSetSwapIntervalPostRetarget': SIGSEGV on setSwapInterval() after changing the context's drawable w/ 'Mesa 8.0.4' dri2SetSwapInterval/DRI2 (soft & intel)
Analyzing 'TestGLContextDrawableSwitchNEWT' crash at setSwapInterval -> dri2SetSwapInterval
after retargeting the context (new drawable association).
Turns out Mesa's dri2SetSwapInterval may have a bug.
+++
GLContext TRACE_SWITCH: Add drawable handle to debug/trace output.
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/GLContext.java')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLContext.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 93b9bfe82..1cee0209c 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -162,6 +162,9 @@ public abstract class GLContext { private int currentSwapInterval; protected GLRendererQuirks glRendererQuirks; + /** Did the drawable association changed ? see {@link GLRendererQuirks#NoSetSwapIntervalPostRetarget} */ + protected boolean drawableRetargeted; + protected void resetStates() { if (DEBUG) { System.err.println(getThreadName() + ": GLContext.resetStates()"); @@ -175,6 +178,7 @@ public abstract class GLContext { contextHandle=0; currentSwapInterval = -1; glRendererQuirks = null; + drawableRetargeted = false; } /** @@ -781,8 +785,8 @@ public abstract class GLContext { } /** - * Set the swap interval if the current context. - * @param interval Should be ≥ 0. 0 Disables the vertical synchronisation, + * Set the swap interval of the current context and attached drawable. + * @param interval Should be ≥ 0. 0 disables the vertical synchronization, * where ≥ 1 is the number of vertical refreshes before a swap buffer occurs. * A value < 0 is ignored. * @return true if the operation was successful, otherwise false @@ -792,9 +796,11 @@ public abstract class GLContext { public final boolean setSwapInterval(int interval) throws GLException { validateCurrent(); if(0<=interval) { - if( setSwapIntervalImpl(interval) ) { - currentSwapInterval = interval; - return true; + if( !drawableRetargeted || !hasRendererQuirk(GLRendererQuirks.NoSetSwapIntervalPostRetarget) ) { + if( setSwapIntervalImpl(interval) ) { + currentSwapInterval = interval; + return true; + } } } return false; @@ -808,15 +814,12 @@ public abstract class GLContext { * the default value <code>-1</code> is returned. * </p> * <p> - * The default value for a valid context is <code>1</code> for - * an EGL based profile (ES1 or ES2) and <code>-1</code> (undefined) - * for desktop. + * For a valid context the default value is <code>1</code> + * in case of an EGL based profile (ES1 or ES2) and <code>-1</code> + * (undefined) for desktop. * </p> */ public final int getSwapInterval() { - if(-1 == currentSwapInterval && this.isGLES()) { - currentSwapInterval = 1; - } return currentSwapInterval; } protected final void setDefaultSwapInterval() { |