diff options
author | Sven Gothel <[email protected]> | 2013-09-21 05:19:32 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-09-21 05:19:32 +0200 |
commit | 4ef07dc20a3d867feb1c51b4ce22ae3d06094781 (patch) | |
tree | 4888a9933d855f47fcc40af7d8dcbc96d9abd4e0 /src/jogl/classes/jogamp | |
parent | 939d6304d464e69b1d1d2a104c3da5536d3bf326 (diff) |
Fix Bug 839: Clarify whether resetStates(..) shall clearStates() - Pass 'isInit' flag.
Diffstat (limited to 'src/jogl/classes/jogamp')
6 files changed, 28 insertions, 28 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index ff90966cd..77cbd0ed9 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -157,19 +157,16 @@ public abstract class GLContextImpl extends GLContext { if (bufferSizeTracker != null) { bufferSizeTracker.clearCachedBufferSizes(); } - if (bufferStateTracker != null) { // <init> - bufferStateTracker.clearBufferObjectState(); - } - if (glStateTracker != null) { // <init> - glStateTracker.setEnabled(false); - glStateTracker.clearStates(); - } + bufferStateTracker.clearBufferObjectState(); + glStateTracker.setEnabled(false); + glStateTracker.clearStates(); } @Override - protected void resetStates() { - clearStates(); - + protected void resetStates(boolean isInit) { + if( !isInit ) { + clearStates(); + } extensionAvailability = null; glProcAddressTable = null; gl = null; @@ -188,7 +185,7 @@ public abstract class GLContextImpl extends GLContext { pixelDataEvaluated = false; - super.resetStates(); + super.resetStates(isInit); } @Override @@ -435,6 +432,7 @@ public abstract class GLContextImpl extends GLContext { if(GLContextShareSet.contextDestroyed(this) && !GLContextShareSet.hasCreatedSharedLeft(this)) { GLContextShareSet.unregisterSharing(this); } + resetStates(false); } finally { lock.unlock(); if ( DEBUG_TRACE_SWITCH ) { @@ -448,8 +446,9 @@ public abstract class GLContextImpl extends GLContext { if( null != associateDrawableException ) { throw new GLException("Exception @ destroy's associateDrawable(false)", associateDrawableException); } + } else { + resetStates(false); } - resetStates(); } protected abstract void destroyImpl() throws GLException; @@ -629,7 +628,7 @@ public abstract class GLContextImpl extends GLContext { */ } if( TRACE_SWITCH ) { - System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - "+lock); + System.err.println(getThreadName() +": GLContext.ContextSwitch[makeCurrent.X3]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+" - switch - "+makeCurrentResultToString(res)+" - stateTracker.on "+glStateTracker.isEnabled()+" - "+lock); } return res; } @@ -868,14 +867,14 @@ public abstract class GLContextImpl extends GLContext { if(PROFILE_ALIASING) { hasGL3 = true; } - resetStates(); // clean context states, since creation was temporary + resetStates(false); // clean context states, since creation was temporary } } if(!hasGL3) { hasGL3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_CORE); // GL3 success |= hasGL3; if(hasGL3) { - resetStates(); // clean this context states, since creation was temporary + resetStates(false); // clean this context states, since creation was temporary } } if(!hasGL4bc) { @@ -897,7 +896,7 @@ public abstract class GLContextImpl extends GLContext { hasGL4 = true; hasGL3 = true; } - resetStates(); // clean this context states, since creation was temporary + resetStates(false); // clean this context states, since creation was temporary } } if(!hasGL3bc) { @@ -913,21 +912,21 @@ public abstract class GLContextImpl extends GLContext { hasGL2 = true; hasGL3 = true; } - resetStates(); // clean this context states, since creation was temporary + resetStates(false); // clean this context states, since creation was temporary } } if(!hasGL2) { hasGL2 = createContextARBMapVersionsAvailable(2, CTX_PROFILE_COMPAT); // GL2 success |= hasGL2; if(hasGL2) { - resetStates(); // clean this context states, since creation was temporary + resetStates(false); // clean this context states, since creation was temporary } } if(!hasES3) { hasES3 = createContextARBMapVersionsAvailable(3, CTX_PROFILE_ES); // ES3 success |= hasES3; if(hasES3) { - resetStates(); // clean this context states, since creation was temporary + resetStates(false); // clean this context states, since creation was temporary } } if(success) { @@ -946,7 +945,7 @@ public abstract class GLContextImpl extends GLContext { } /** - * Note: Since context creation is temporary, caller need to issue {@link #resetStates()}, if creation was successful, i.e. returns true. + * Note: Since context creation is temporary, caller need to issue {@link #resetStates(boolean)}, if creation was successful, i.e. returns true. * This method does not reset the states, allowing the caller to utilize the state variables. **/ private final boolean createContextARBMapVersionsAvailable(int reqMajor, int reqProfile) { diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java index 69411979f..01c3716e0 100644 --- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java @@ -42,6 +42,7 @@ package jogamp.opengl; import javax.media.opengl.*; import com.jogamp.common.util.IntIntHashMap; + import java.nio.IntBuffer; import java.util.ArrayList; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index e7977e3fb..179cb7504 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -70,12 +70,12 @@ public class EGLContext extends GLContextImpl { } @Override - protected void resetStates() { + protected void resetStates(boolean isInit) { eglQueryStringInitialized = false; eglQueryStringAvailable = false; eglExtProcAddressTable = null; // no inner state _eglExt = null; - super.resetStates(); + super.resetStates(isInit); } @Override diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 6787ef500..e6334150b 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -193,10 +193,10 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected void resetStates() { + protected void resetStates(boolean isInit) { // no inner state _cglExt = null; cglExtProcAddressTable = null; - super.resetStates(); + super.resetStates(isInit); } @Override diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index b8979c91e..3fad22d88 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -93,7 +93,7 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - protected void resetStates() { + protected void resetStates(boolean isInit) { wglGetExtensionsStringEXTInitialized=false; wglGetExtensionsStringEXTAvailable=false; wglGLReadDrawableAvailableSet=false; @@ -102,7 +102,7 @@ public class WindowsWGLContext extends GLContextImpl { wglExtProcAddressTable=null; hasSwapIntervalSGI = 0; hasSwapGroupNV = 0; - super.resetStates(); + super.resetStates(isInit); } @Override diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 4bfe0cb86..0ecf11a43 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -100,7 +100,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected void resetStates() { + protected void resetStates(boolean isInit) { // no inner state _glXExt=null; glXExtProcAddressTable = null; hasSwapInterval = 0; @@ -108,7 +108,7 @@ public class X11GLXContext extends GLContextImpl { isDirect = false; glXServerVersion = null; isGLXVersionGreaterEqualOneThree = false; - super.resetStates(); + super.resetStates(isInit); } @Override |