aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-03-09 04:23:55 +0100
committerSven Gothel <[email protected]>2013-03-09 04:23:55 +0100
commitd3672684177a98a58c434bcd27541f44917050f3 (patch)
treed4f7fd36cc1178172b1524bc3e1cd2ec3d7ac383
parentb29f221c903aefdf99af8e8a8544b2223036454f (diff)
Fix Mix2TexturesES2 unit tests: Use synchronized texID access and add glFinish() after demo -> FBO rendering on or off thread.
Fixes shared GLContext OSX rendering.
-rwxr-xr-xmake/scripts/tests.sh26
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/GLFinishOnDisplay.java40
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java37
5 files changed, 90 insertions, 18 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index d5b045c6b..5d259d6be 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -172,7 +172,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug=all"
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug.JAWT -Djogl.debug.Animator"
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.GLDrawable"
- D_ARGS="-Dnewt.debug.Window"
+ #D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Xprof"
#D_ARGS="-Dnativewindow.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel"
@@ -192,6 +192,8 @@ function jrun() {
#D_ARGS="-Dnewt.debug=all -Djogamp.debug.Lock.TraceLock -Djogamp.common.utils.locks.Lock.timeout=600000"
#D_ARGS="-Dnewt.debug=all -Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
#D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all -Djogamp.debug.Lock -Djogamp.common.utils.locks.Lock.timeout=10000"
+ #D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all"
+ #D_ARGS="-Dnewt.debug=all"
#D_ARGS="-Dnewt.debug=all"
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.GLJPanel"
#X_ARGS="-Dsun.java2d.noddraw=True -Dsun.java2d.opengl=True -Dsun.java2d.xrender=false"
@@ -342,7 +344,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableFactoryNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
-#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOnThreadSharedContext1DemoES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMix2DemosES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOMRTNEWT01 $*
@@ -382,7 +384,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT $*
-testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug611AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWT01GLn $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestSwingAWT01GLn
@@ -396,6 +398,7 @@ testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461PBufferSupersamplingSwingAWT
#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug463ScaleImageMemoryAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.glu.TestBug694ScaleImageUnpackBufferSizeAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWTCardLayoutAnimatorStartStopBug532 $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock00AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestGLCanvasAWTActionDeadlock01AWT $*
@@ -546,6 +549,23 @@ testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug572AWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBODrawableNEWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
+#
+# OSX Java6 NEWT
+#
+
+# Cut-off top
+#testnoawt com.jogamp.opengl.test.junit.jogl.util.TestPNGImage01NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.util.texture.TestPNGTextureFromFileNEWT $*
+
+# Child too low
+#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT $*
+
+# NPE:
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitch11NEWT $*
+
+# test rotation change
+#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode02NEWT
+
#linux:
# ATI/Linux: XCB Unknown request in queue while dequeuing
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
index 3ecf89bfc..19e57c9bc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
@@ -44,6 +44,7 @@ import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.FPSAnimator;
import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.texture.TextureIO;
+import com.jogamp.opengl.test.junit.jogl.demos.GLFinishOnDisplay;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.Mix2TexturesES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
@@ -136,6 +137,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
{
GearsES2 demo0 = new GearsES2(-1);
fbod1.addGLEventListener(demo0);
+ fbod1.addGLEventListener(new GLFinishOnDisplay());
demo0.setIgnoreFocus(true);
}
fbod1.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() {
@@ -152,6 +154,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight(), glWindow.getContext());
fbod2.setTextureUnit(fbod2_texUnit);
fbod2.addGLEventListener(new RedSquareES2(-1));
+ fbod2.addGLEventListener(new GLFinishOnDisplay());
fbod2.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() {
@Override
public void surfaceUpdated(Object updater, NativeSurface ns, long when) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
index 7d9a9c662..acd46f57f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
@@ -43,6 +43,7 @@ import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.GLReadBufferUtil;
import com.jogamp.opengl.util.texture.TextureIO;
+import com.jogamp.opengl.test.junit.jogl.demos.GLFinishOnDisplay;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.Mix2TexturesES2;
@@ -133,6 +134,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
{
GearsES2 demo0 = new GearsES2(-1);
fbod1.addGLEventListener(demo0);
+ fbod1.addGLEventListener(new GLFinishOnDisplay());
demo0.setIgnoreFocus(true);
}
fbod1.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLFinishOnDisplay.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLFinishOnDisplay.java
new file mode 100644
index 000000000..cb76f1057
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLFinishOnDisplay.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (C) 2013 JogAmp Community. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+package com.jogamp.opengl.test.junit.jogl.demos;
+
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLEventListener;
+
+public class GLFinishOnDisplay implements GLEventListener {
+ @Override
+ public void init(GLAutoDrawable drawable) { }
+
+ @Override
+ public void dispose(GLAutoDrawable drawable) { }
+
+ @Override
+ public void display(GLAutoDrawable drawable) {
+ drawable.getGL().glFinish();
+ }
+
+ @Override
+ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java
index 26e7e234a..cd40b5c6e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java
@@ -42,7 +42,8 @@ public class Mix2TexturesES2 implements GLEventListener {
private final PMVMatrix pmvMatrix;
private final GLUniformData texUnit0, texUnit1;
- private volatile int texID0, texID1;
+ private Object syncTexIDs = new Object();
+ private int texID0, texID1;
private ShaderProgram sp0;
private GLUniformData pmvMatrixUniform;
private GLArrayDataServer interleavedVBO;
@@ -66,10 +67,14 @@ public class Mix2TexturesES2 implements GLEventListener {
}
public void setTexID0(int texID) {
- this.texID0 = texID;
+ synchronized( syncTexIDs ) {
+ this.texID0 = texID;
+ }
}
public void setTexID1(int texID) {
- this.texID1 = texID;
+ synchronized( syncTexIDs ) {
+ this.texID1 = texID;
+ }
}
static final String[] es2_prelude = { "#version 100\n", "precision mediump float;\n" };
@@ -156,20 +161,22 @@ public class Mix2TexturesES2 implements GLEventListener {
interleavedVBO.enableBuffer(gl, true);
- if(0<texID0) {
- gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue());
- gl.glBindTexture(GL.GL_TEXTURE_2D, texID0);
- }
-
- if(0<texID1 && null != texUnit1) {
- gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit1.intValue());
- gl.glBindTexture(GL.GL_TEXTURE_2D, texID1);
+ synchronized( syncTexIDs ) {
+ if(0<texID0) {
+ gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue());
+ gl.glBindTexture(GL.GL_TEXTURE_2D, texID0);
+ }
+
+ if(0<texID1 && null != texUnit1) {
+ gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit1.intValue());
+ gl.glBindTexture(GL.GL_TEXTURE_2D, texID1);
+ }
+
+ gl.glEnable(GL.GL_TEXTURE_2D);
+
+ gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
}
- gl.glEnable(GL.GL_TEXTURE_2D);
-
- gl.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4);
-
interleavedVBO.enableBuffer(gl, false);
st.useProgram(gl, false);