diff options
author | Sven Gothel <[email protected]> | 2011-02-26 07:35:24 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-02-26 07:35:24 +0100 |
commit | 112e2a26004d974c3bba822fe1467a34784ec57d (patch) | |
tree | 560f5ff859587d142126beb0578ffc123d6ac99c | |
parent | 7f2079513b661c69b82f90770f4147530f8db8a2 (diff) |
GLProfile: More Tolerant for missing features; MacOSX: Fix External Context / SWT; SWT Test: Distinguish awt/headless and main-thread (osx) swt launch
-rw-r--r-- | make/build-common.xml | 8 | ||||
-rw-r--r-- | make/build-test.xml | 78 | ||||
-rwxr-xr-x | make/scripts/tests-osx.sh | 7 | ||||
-rwxr-xr-x | make/scripts/tests-x32.sh | 7 | ||||
-rwxr-xr-x | make/scripts/tests-x64.sh | 7 | ||||
-rwxr-xr-x | make/scripts/tests.sh | 37 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLProfile.java | 16 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java | 3 | ||||
-rw-r--r-- | src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java | 9 |
9 files changed, 147 insertions, 25 deletions
diff --git a/make/build-common.xml b/make/build-common.xml index f34280ea0..4d38d7458 100644 --- a/make/build-common.xml +++ b/make/build-common.xml @@ -262,8 +262,8 @@ <pathelement location="${jogl.test.jar}" /> </path> - <!-- classpath used when running SWT tests --> - <path id="junit_jogl_swt.run.classpath"> + <!-- classpath used when running SWT tests --> + <path id="junit_jogl_swt.run.classpath"> <pathelement location="${junit.jar}" /> <pathelement location="${ant.jar}" /> <pathelement location="${ant-junit.jar}" /> @@ -273,7 +273,9 @@ <pathelement location="${jogl.all.jar}" /> <pathelement location="${newt.event.jar}" /> <pathelement location="${jogl.test.jar}" /> - </path> + </path> + <property name="junit_jogl_swt.run.jars" + value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${gluegen-rt.jar}${path.separator}${swt.jar}${path.separator}${nativewindow.all.jar}${path.separator}${jogl.all.jar}${path.separator}${newt.all.jar}${path.separator}${jogl.test.jar}"/> <path id="junit_jogl_newt.run.classpath"> <pathelement location="${junit.jar}" /> diff --git a/make/build-test.xml b/make/build-test.xml index ac60d09eb..7c80b5f53 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -27,8 +27,10 @@ <property name="java.dir.bugs" value="${java.dir.test}/bugs"/> <property name="test.archive.name" value="${archive.name}-test-results-${build.node.name}"/> - <condition property="jvmarg.newt.headless" value="-XstartOnFirstThread -Djava.awt.headless=true"><isset property="isOSX"/></condition> - <condition property="jvmarg.newt.headless" value="-Djava.awt.headless=true"><not><isset property="isOSX"/></not></condition> + <condition property="jvmarg.mainthrd" value="-XstartOnFirstThread"><isset property="isOSX"/></condition> + <condition property="jvmarg.mainthrd" value="-Ddummy"><not><isset property="isOSX"/></not></condition> + <condition property="jvmarg.headless" value="-XstartOnFirstThread -Djava.awt.headless=true"><isset property="isOSX"/></condition> + <condition property="jvmarg.headless" value="-Djava.awt.headless=true"><not><isset property="isOSX"/></not></condition> <property name="batchtest.timeout" value="1800000"/> <!-- 30 min --> </target> @@ -209,7 +211,7 @@ <env key="${system.env.library.path}" path="${obj.all.paths}"/> <env key="CLASSPATH" value="${junit_jogl_newt.run.jars}"/> <arg value="-Djava.library.path=${obj.all.paths}"/> - <arg line="${jvmarg.newt.headless}"/> + <arg line="${jvmarg.headless}"/> <!-- <arg line="-Dnewt.debug.EDT"/> --> @@ -307,11 +309,75 @@ </junit> </target> - <target name="junit.run.swt" depends="test.compile" description="Runs all SWT and SWT_AWT tests."> + <target name="junit.run.swt.headless" depends="test.compile" description="Runs all pure SWT tests."> + <!-- Test*SWT* + + Emulation of junit task, + due to the fact that we have to place invoke our MainThread class first (-> MacOSX). + + Utilizing Ant-1.8.0 and ant-contrib-1.0b3 (loops, mutable properties). + --> + <for param="test.class.path.m" keepgoing="true"> + <!-- results in absolute path --> + <fileset dir="${classes}"> + <include name="${java.dir.junit}/**/Test*SWT*"/> + <exclude name="**/*$$*"/> + <exclude name="**/*AWT*"/> + <exclude name="**/newt/**"/> + </fileset> + <sequential> + <var name="test.class.path" unset="true"/> + <property name="test.class.path" basedir="${classes}" relative="true" location="@{test.class.path.m}"/> + <var name="test.class.fqn" unset="true"/> + <pathconvert property="test.class.fqn"> + <fileset file="${classes}${file.separator}${test.class.path}"/> + <chainedmapper> + <globmapper from="${classes.path}${file.separator}*" to="*"/> <!-- rel. --> + <packagemapper from="*.class" to="*"/> <!-- FQCN --> + </chainedmapper> + </pathconvert> + <var name="test.class.result.file" value="${results.test}/TEST-${test.class.fqn}.xml"/> + <echo message="Testing ${test.class.fqn} -- ${test.class.result.file}"/> + <apply dir="." executable="${java.home}/bin/java" + parallel="false" + timeout="${batchtest.timeout}" + vmlauncher="false" + relative="true" + failonerror="false"> + <env key="${system.env.library.path}" path="${obj.all.paths}"/> + <env key="CLASSPATH" value="${junit_jogl_swt.run.jars}"/> + <arg value="-Djava.library.path=${obj.all.paths}"/> + <arg line="${jvmarg.headless}"/> + <!-- + <arg line="-Dnewt.debug.EDT"/> + --> + <arg line="com.jogamp.newt.util.MainThread"/> + <arg line="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner"/> + <srcfile/> + <arg line="filtertrace=true"/> + <arg line="haltOnError=false"/> + <arg line="haltOnFailure=false"/> + <arg line="showoutput=true"/> + <arg line="outputtoformatters=true"/> + <arg line="logfailedtests=true"/> + <arg line="logtestlistenerevents=true"/> + <arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter"/> + <arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.class.result.file}"/> + <mappedresources> + <fileset dir="${classes}" includes="${test.class.path}"/> + <packagemapper from="*.class" to="*"/> + </mappedresources> + </apply> + </sequential> + </for> + </target> + + <target name="junit.run.swt.awt" depends="test.compile" description="Runs all SWT_AWT tests."> <!-- Test*SWT* --> <junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}"> <env key="${system.env.library.path}" path="${obj.all.paths}"/> <jvmarg value="-Djava.library.path=${obj.all.paths}"/> + <jvmarg value="${jvmarg.mainthrd}"/> <!-- <jvmarg value="-Djogl.debug=all"/> @@ -330,7 +396,7 @@ <batchtest todir="${results.test}"> <fileset dir="${classes}"> - <include name="${java.dir.junit}/**/Test*SWT*"/> + <include name="${java.dir.junit}/**/Test*SWT*AWT*"/> <exclude name="**/*$$*"/> <exclude name="**/newt/**"/> </fileset> @@ -376,7 +442,7 @@ </target> <target name="test.auto.run" depends="junit.run"/> - <target name="junit.run" depends="junit.run.noui,junit.run.newt.headless,junit.run.awt,junit.run.newt.awt,junit.run.swt"> + <target name="junit.run" depends="junit.run.noui,junit.run.newt.headless,junit.run.awt,junit.run.newt.awt,junit.run.swt.headless,junit.run.swt.awt"> <antcall target="test-zip-archive" inheritRefs="true" inheritAll="true"/> </target> diff --git a/make/scripts/tests-osx.sh b/make/scripts/tests-osx.sh new file mode 100755 index 000000000..79c4e6742 --- /dev/null +++ b/make/scripts/tests-osx.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +spath=`dirname $0` + +. $spath/tests.sh /usr/bin/java ../build-macosx + + diff --git a/make/scripts/tests-x32.sh b/make/scripts/tests-x32.sh new file mode 100755 index 000000000..553392f89 --- /dev/null +++ b/make/scripts/tests-x32.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +spath=`dirname $0` + +. $spath/tests.sh /opt-linux-x86/j2se6/bin/java ../build-x86 + + diff --git a/make/scripts/tests-x64.sh b/make/scripts/tests-x64.sh new file mode 100755 index 000000000..202280cc1 --- /dev/null +++ b/make/scripts/tests-x64.sh @@ -0,0 +1,7 @@ +#! /bin/bash + +spath=`dirname $0` + +. $spath/tests.sh /opt-linux-x86_64/j2se6/bin/java ../build-x86_64 + + diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 682158eea..cedb51d9c 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -25,6 +25,12 @@ spath=`dirname $0` . $spath/setenv-jogl.sh $bdir JOGL_ALL +MOSX=0 +uname -a | grep -i Darwin && MOSX=1 +if [ $MOSX -eq 1 ] ; then + MOSX_MT=1 +fi + which $javaexe 2>&1 | tee -a java-run.log $javaexe -version 2>&1 | tee -a java-run.log echo LIBXCB_ALLOW_SLOPPY_LOCK: $LIBXCB_ALLOW_SLOPPY_LOCK 2>&1 | tee -a java-run.log @@ -33,9 +39,10 @@ echo LIBGL_DEBUG: $LIBGL_DEBUG 2>&1 | tee -a java-run.log echo SWT_CLASSPATH: $SWT_CLASSPATH 2>&1 | tee -a java-run.log echo $javaexe $X_ARGS $D_ARGS $* 2>&1 | tee -a java-run.log echo CLASSPATH $CLASSPATH 2>&1 | tee -a java-run.log +echo MacOsX $MOSX function jrun() { - awtarg=$1 + awton=$1 shift #D_ARGS="-Djogl.debug.ExtensionAvailabilityCache -Djogl.debug=all -Dnativewindow.debug=all -Djogamp.debug.ProcAddressHelper=true -Djogamp.debug.NativeLibrary=true -Djogamp.debug.NativeLibrary.Lookup=true" @@ -54,7 +61,7 @@ function jrun() { #D_ARGS="-Djogl.debug.GLContext -Dnewt.debug=all" #D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.EDT -Djogamp.debug.Lock" #D_ARGS="-Dnewt.debug.EDT" - #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all" + D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext" #D_ARGS="-Dnewt.debug=all" @@ -65,21 +72,36 @@ function jrun() { #D_ARGS="-Dnativewindow.debug.ToolkitLock.TraceLock" #X_ARGS="-Dsun.java2d.noddraw=true -Dsun.java2d.opengl=true" #X_ARGS="-verbose:jni" + + if [ $awton -eq 1 ] ; then + X_ARGS="-Djava.awt.headless=false" + else + X_ARGS="-Djava.awt.headless=true" + fi + if [ $MOSX_MT -eq 1 ] ; then + X_ARGS="-XstartOnFirstThread $X_ARGS" + C_ARG="com.jogamp.newt.util.MainThread" + fi echo echo "Test Start: $*" echo - $javaexe $awtarg $X_ARGS $D_ARGS $* + $javaexe $X_ARGS $D_ARGS $C_ARG $* echo echo "Test End: $*" echo } function testnoawt() { - jrun -Djava.awt.headless=true $* 2>&1 | tee -a java-run.log + jrun 0 $* 2>&1 | tee -a java-run.log } function testawt() { - jrun -Djava.awt.headless=false $* 2>&1 | tee -a java-run.log + MOSX_MT=0 + jrun 1 $* 2>&1 | tee -a java-run.log +} + +function testawtmt() { + jrun 1 $* 2>&1 | tee -a java-run.log } # @@ -109,6 +131,7 @@ function testawt() { #testawt com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT -time 1000000 #testawt -Djava.awt.headless=true com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT #testawt com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated +#testnoawt com.jogamp.opengl.test.junit.jogl.swt.TestSWT01GLn $* # @@ -126,15 +149,15 @@ function testawt() { #testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.gears.TestGearsGLJPanelAWT $* #testawt com.jogamp.opengl.test.junit.jogl.texture.TestTexture01AWT #testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleAWT -#testawt com.jogamp.opengl.test.junit.jogl.swt.TestSWT01GLn $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461OffscreenSupersamplingSwingAWT #testawt com.jogamp.opengl.test.junit.jogl.texture.TestGrayTextureFromFileAWTBug417 +testawtmt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAWT01GLn $* # # newt.awt (testawt) # #testawt com.jogamp.opengl.test.junit.jogl.newt.TestSwingAWTRobotUsageBeforeJOGLInitBug411 -testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.gears.newt.TestGearsNewtAWTWrapper +#testawt com.jogamp.opengl.test.junit.jogl.demos.gl2.gears.newt.TestGearsNewtAWTWrapper #testawt com.jogamp.opengl.test.junit.newt.TestEventSourceNotAWTBug #testawt com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot #testawt com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index b2f63cec4..17313f770 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -1393,12 +1393,16 @@ public class GLProfile { private static void dumpGLInfo(GLDrawableFactoryImpl factory, AbstractGraphicsDevice device) { GLContext ctx = factory.getOrCreateSharedContext(device); - System.err.println("GLProfile.dumpGLInfo: "+ctx); - ctx.makeCurrent(); - try { - System.err.println(JoglVersion.getGLInfo(ctx.getGL(), null)); - } finally { - ctx.release(); + if(null != ctx) { + System.err.println("GLProfile.dumpGLInfo: "+ctx); + ctx.makeCurrent(); + try { + System.err.println(JoglVersion.getGLInfo(ctx.getGL(), null)); + } finally { + ctx.release(); + } + } else { + System.err.println("GLProfile.dumpGLInfo: shared context n/a"); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java index 8e27c217b..fa0a0b6ed 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawableFactory.java @@ -50,6 +50,7 @@ import javax.media.opengl.*; import com.jogamp.common.JogampRuntimeException; import com.jogamp.common.util.*; +import java.util.ArrayList; import jogamp.opengl.*; import jogamp.nativewindow.WrappedSurface; @@ -127,7 +128,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { protected final void shutdownInstance() {} protected List/*GLCapabilitiesImmutable*/ getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { - throw new UnsupportedOperationException("not yet implemented"); + return new ArrayList(0); } protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java index af055913d..6303f2e43 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java @@ -65,16 +65,17 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { long contextHandle = CGL.getCurrentContext(); // Check: MacOSX 10.3 .. boolean isNSContext = 0 != contextHandle; if( isNSContext ) { - currentDrawable = CGL.getNSView(contextHandle); long ctx = CGL.getCGLContext(contextHandle); if (ctx == 0) { throw new GLException("Error: NULL Context (CGL) of Context (NS) 0x" +Long.toHexString(contextHandle)); } pixelFormat = CGL.CGLGetPixelFormat(ctx); + currentDrawable = CGL.getNSView(contextHandle); if(DEBUG) { System.err.println("MacOSXExternalCGLContext Create Context (NS) 0x"+Long.toHexString(contextHandle)+ ", Context (CGL) 0x"+Long.toHexString(ctx)+ - ", pixelFormat 0x"+Long.toHexString(pixelFormat)); + ", pixelFormat 0x"+Long.toHexString(pixelFormat)+ + ", drawable 0x"+Long.toHexString(currentDrawable)); } } else { contextHandle = CGL.CGLGetCurrentContext(); @@ -99,6 +100,10 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps, pixelFormat); + if(0 == currentDrawable) { + // set a fake marker stating a valid drawable + currentDrawable = 1; + } WrappedSurface ns = new WrappedSurface(cfg); ns.setSurfaceHandle(currentDrawable); return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle); |