diff options
author | Sven Gothel <[email protected]> | 2019-12-09 07:07:36 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-12-09 07:07:36 +0100 |
commit | 3c9b7bcec2ae06060726c49e34b1d606f66d31c6 (patch) | |
tree | 8f5458ab6ca8c96edbcfd035bd55666642df1217 /src/test/com/jogamp | |
parent | 3e92d34de3672d7f5e401ed6181bb55a58bdf4b6 (diff) |
Bug 1416 - Allow EGLDrawableFactory re-creation after shutdown() - be functional
TestShutdownCompleteNEWT revealed that EGLDrawableFactory won't be properly
re-created within subsequent GLProfile/GLDrawableFactory initSingleton()
after a GLProfile.shutdown() call.
Hence after the shutdown() call, subsequent GLProfile have no EGLDrawableFactory available and hence may not have a default device existent in case no desktop-factory is available.
Allow EGLDrawableFactory to be re-created after a shutdown().
Diffstat (limited to 'src/test/com/jogamp')
3 files changed, 35 insertions, 5 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java index 7a5b49168..db26e107d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java @@ -70,6 +70,9 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { @BeforeClass public static void initClass() { + System.err.println("GLprofile default: "+GLProfile.getDefault()); + System.err.println("GLprofile defaultDevice: "+GLProfile.getDefaultDevice()); + final Window dummyWindow = NewtFactory.createWindow(new Capabilities()); dummyWindow.setSize(demoWinSize, demoWinSize); dummyWindow.setVisible(true); @@ -100,6 +103,9 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase { final int x = ( id % num_x ) * ( demoWinSize + insets.getTotalHeight() ); final int y = ( (id / num_x) % num_y ) * ( demoWinSize + insets.getTotalHeight() ); + System.err.println("GLprofile default: "+GLProfile.getDefault()); + System.err.println("GLprofile defaultDevice: "+GLProfile.getDefaultDevice()); + System.err.println("JOGLTask "+id+": START: "+x+"/"+y+", reuse "+reuse+" - "+Thread.currentThread().getName()); final Display display = NewtFactory.createDisplay(null, reuse); final Screen screen = NewtFactory.createScreen(display, 0); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfileXXNEWTPost.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfileXXNEWTPost.java index e185eee0a..7d2db881f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfileXXNEWTPost.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLProfileXXNEWTPost.java @@ -30,10 +30,12 @@ package com.jogamp.opengl.test.junit.jogl.acore; import java.io.IOException; +import com.jogamp.nativewindow.AbstractGraphicsDevice; import com.jogamp.opengl.GLCapabilities; import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.opengl.GLProfile; +import org.junit.Assert; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; @@ -47,10 +49,17 @@ public class TestGLProfileXXNEWTPost extends GLProfile0XBase { @Test public void test01GLProfileDefault() throws InterruptedException { - System.out.println("GLProfile "+GLProfile.glAvailabilityToString()); - System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice()); final GLProfile glp = GLProfile.getDefault(); System.out.println("GLProfile.getDefault(): "+glp); + + final AbstractGraphicsDevice gd = GLProfile.getDefaultDevice(); + final GLProfile glp2 = GLProfile.getDefault(gd); + System.out.println("GLProfile.getDefaultDevice(): "+gd); + System.out.println("GLProfile.getDefault(gd): "+glp2); + Assert.assertEquals(glp, glp2); + + System.out.println("GLProfile "+GLProfile.glAvailabilityToString()); + final GLCapabilitiesImmutable caps = new GLCapabilities(glp); validateOnlineOffscreen("default", caps); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java index 13c4f077a..d0c230609 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestShutdownCompleteNEWT.java @@ -40,6 +40,8 @@ import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; import com.jogamp.common.os.Platform; +import com.jogamp.junit.util.JunitTracer; +import com.jogamp.nativewindow.AbstractGraphicsDevice; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -84,17 +86,30 @@ public class TestShutdownCompleteNEWT extends UITestCase { @AfterClass public static void afterAll() { if(waitForKey) { - UITestCase.waitForKey("Exit"); + JunitTracer.waitForKey("Exit"); } } protected void oneLife(final boolean glInfo) throws InterruptedException { if(waitForEach) { - UITestCase.waitForKey("Start One Life"); + JunitTracer.waitForKey("Start One Life"); } final long t0 = Platform.currentTimeMicros(); GLProfile.initSingleton(); final long t1 = Platform.currentTimeMicros(); + + // Test minimum requirement, having a default device with profile + { + final GLProfile glp = GLProfile.getDefault(); + System.out.println("GLProfile.getDefault(): "+glp); + + final AbstractGraphicsDevice gd = GLProfile.getDefaultDevice(); + final GLProfile glp2 = GLProfile.getDefault(gd); + System.out.println("GLProfile.getDefaultDevice(): "+gd); + System.out.println("GLProfile.getDefault(gd): "+glp2); + Assert.assertEquals(glp, glp2); + } + if(!initOnly) { runTestGL(true); } @@ -150,7 +165,7 @@ public class TestShutdownCompleteNEWT extends UITestCase { } if(waitForKey) { - UITestCase.waitForKey("Start"); + JunitTracer.waitForKey("Start"); } final String tstname = TestShutdownCompleteNEWT.class.getName(); |