diff options
author | Sven Gothel <[email protected]> | 2013-06-16 04:04:29 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-06-16 04:04:29 +0200 |
commit | 646a1f18c6f7e755f6ae3cbb3f2282b1b1bc9e5f (patch) | |
tree | 2aab837de73313cb47cbf7ef9828637957a9527e /src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | |
parent | 2d83e346b1e737f9efc0e782ddbd2a9be6a4cd35 (diff) |
GLDrawableHelper Perf.: Branch into execGLRunnables(..) only if glRunnables.size()>0
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/GLDrawableHelper.java')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/GLDrawableHelper.java | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 177c465da..ed3a1593e 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -559,7 +559,7 @@ public class GLDrawableHelper { public final void display(GLAutoDrawable drawable) { displayImpl(drawable); - if(!execGLRunnables(drawable)) { + if( glRunnables.size()>0 && !execGLRunnables(drawable) ) { // glRunnables volatile OK; execGL.. only executed if size > 0 displayImpl(drawable); } } @@ -603,24 +603,22 @@ public class GLDrawableHelper { } } - private final boolean execGLRunnables(GLAutoDrawable drawable) { + private final boolean execGLRunnables(GLAutoDrawable drawable) { // glRunnables.size()>0 boolean res = true; - if(glRunnables.size()>0) { // volatile OK - // swap one-shot list asap - final ArrayList<GLRunnableTask> _glRunnables; - synchronized(glRunnablesLock) { - if(glRunnables.size()>0) { - _glRunnables = glRunnables; - glRunnables = new ArrayList<GLRunnableTask>(); - } else { - _glRunnables = null; - } + // swap one-shot list asap + final ArrayList<GLRunnableTask> _glRunnables; + synchronized(glRunnablesLock) { + if(glRunnables.size()>0) { + _glRunnables = glRunnables; + glRunnables = new ArrayList<GLRunnableTask>(); + } else { + _glRunnables = null; } - - if(null!=_glRunnables) { - for (int i=0; i < _glRunnables.size(); i++) { - res = _glRunnables.get(i).run(drawable) && res; - } + } + + if(null!=_glRunnables) { + for (int i=0; i < _glRunnables.size(); i++) { + res = _glRunnables.get(i).run(drawable) && res; } } return res; |