diff options
author | Sven Gothel <[email protected]> | 2012-12-29 23:37:36 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-12-29 23:37:36 +0100 |
commit | 3ce0aa6e36d9474ac3105cab491a60327860757d (patch) | |
tree | f2dee4f862730a6fbc59881204525d6839df86b6 /src/test/com | |
parent | 74d8e51e1cbb436eab6b90f78de90dacd10e60a5 (diff) |
Fix Bug 658 (Mesa 9.0 3.1 Intel compat quirk, 3.1 core only) ; No PROFILE_ALIASING compat -> core ; Fix setGLFunctionAvailability(..) failure path @ profile query
- Add GLRendererQuirks.GLNonCompliant, marking a GL context/profile non compliant.
Currently: 'Mesa DRI Intel(R) Sandybridge Desktop' && 3.1 compat profile
- Fix Bug 658 (Mesa 9.0 3.1 Intel compat quirk, 3.1 core only)
Detect case using new GLRendererQuirks.GLNonCompliant in setGLFunctionAvailability() and return 'false'.
- No PROFILE_ALIASING compat -> core
Use true core GL profiles / context if available to ensure
proper API behavior across platforms due to different functionality.
E.g. don't use GL3bc if GL3 is requested.
- Fix setGLFunctionAvailability(..) failure path @ profile query
Destroy temp context & zero result to cont. iterating through GL versions.
This missing cleanup lead to returning the faulty GL context handle and it's mapping/usage.
Diffstat (limited to 'src/test/com')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLUnitsNEWT.java) | 16 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java | 200 |
2 files changed, 214 insertions, 2 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLUnitsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java index c699e6304..90f0c5414 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLUnitsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug651NEWT.java @@ -45,7 +45,19 @@ import org.junit.BeforeClass; import org.junit.AfterClass; import org.junit.Test; -public class TestGLUnitsNEWT extends UITestCase { +/** + * Some GL state values are broken w/ Mesa 9.0 w/ multiple different context. + * <p> + * This bug lies within Mesa3D (any renderer) and is fixed in + * commit 8dc79ae7d73cf6711c2182ff9a5d37ef6c989d23. + * </p> + * <p> + * Mesa3D Version 9.0 still exposes this bug, + * where 9.0.1 has it fixed w/ above commit. + * </p> + * <https://jogamp.org/bugzilla/show_bug.cgi?id=651> + */ +public class TestGLMesaBug651NEWT extends UITestCase { static int width, height; @BeforeClass @@ -205,6 +217,6 @@ public class TestGLUnitsNEWT extends UITestCase { } public static void main(String args[]) { - org.junit.runner.JUnitCore.main(TestGLUnitsNEWT.class.getName()); + org.junit.runner.JUnitCore.main(TestGLMesaBug651NEWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java new file mode 100644 index 000000000..25b0b930c --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLMesaBug658NEWT.java @@ -0,0 +1,200 @@ +package com.jogamp.opengl.test.junit.jogl.acore; + +import javax.media.opengl.GL; +import javax.media.opengl.GL2GL3; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLContext; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLProfile; + +import org.junit.Assert; +import org.junit.Test; + +import com.jogamp.newt.opengl.GLWindow; +import com.jogamp.opengl.JoglVersion; +import com.jogamp.opengl.test.junit.util.UITestCase; + +/** + * The 3.1 compatibility context on Mesa >= 9.0 seems to be broken. + * <p> + * This bug lies within Mesa3D (any renderer) and is fixed in + * commit ??? (not yet). + * </p> + * <p> + * Mesa3D Version 9.0 still exposes this bug, + * where 9.?.? has it fixed w/ above commit. + * </p> + * <https://jogamp.org/bugzilla/show_bug.cgi?id=658> + */ +public class TestGLMesaBug658NEWT extends UITestCase { + + @Test + public void test00ShowAvailProfiles() { + System.err.println(JoglVersion.getDefaultOpenGLInfo(null, null, false).toString()); + } + + @Test + public void test10GL2PolygonModeFailure() { + testGLNPolygonModeFailureImpl(GLProfile.GL2); + } + + @Test + public void test11GL3bcPolygonModeFailure() { + testGLNPolygonModeFailureImpl(GLProfile.GL3bc); + } + + @Test + public void test12GL3PolygonModeFailure() { + testGLNPolygonModeFailureImpl(GLProfile.GL3); + } + + private void testGLNPolygonModeFailureImpl(String profile) { + if(!GLProfile.isAvailable(profile)) { System.err.println(profile+" n/a"); return; } + + final GLProfile pro = GLProfile.get(profile); + final GLCapabilities caps = new GLCapabilities(pro); + final GLWindow window = GLWindow.create(caps); + + window.setSize(640, 480); + window.addGLEventListener(new GLEventListener() { + public void reshape( + final GLAutoDrawable drawable, + final int x, + final int y, + final int width, + final int height) + { + // Nothing. + } + + public void init( + final GLAutoDrawable drawable) + { + final GLContext context = drawable.getContext(); + System.err.println("CTX: "+context.getGLVersion()); + + final GL2GL3 gl = drawable.getGL().getGL2GL3(); + System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR)); + System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER)); + System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION)); + System.err.println("GL Renderer Quirks:" + gl.getContext().getRendererQuirks().toString()); + + if( gl.isGL2() || gl.isGLES2() ) { // compatibility profile || ES2 + gl.glPolygonMode(GL.GL_FRONT, GL2GL3.GL_FILL); + } else { + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_FILL); + } + + final int e = gl.glGetError(); + Assert.assertTrue(e == GL.GL_NO_ERROR); // // FIXME On Mesa 9.0.1 w/ GL 3.1 -> GL.GL_INVALID_OPERATION ? + } + + public void dispose( + final GLAutoDrawable drawable) + { + // Nothing. + } + + public void display( + final GLAutoDrawable drawable) + { + // Nothing. + } + }); + + try { + window.setVisible(true); + } finally { + window.destroy(); + } + } + + @Test + public void test20GL2BindArrayAttributeFails() { + testGLNBindArrayAttributeFailsImpl(GLProfile.GL2); + } + + @Test + public void test21GL3bcBindArrayAttributeFails() { + testGLNBindArrayAttributeFailsImpl(GLProfile.GL3bc); + } + + @Test + public void test22GL3BindArrayAttributeFails() { + testGLNBindArrayAttributeFailsImpl(GLProfile.GL3); + } + + private void testGLNBindArrayAttributeFailsImpl(String profile) { + if(!GLProfile.isAvailable(profile)) { System.err.println(profile+ " n/a"); return; } + + final GLProfile pro = GLProfile.get(profile); + final GLCapabilities caps = new GLCapabilities(pro); + final GLWindow window = GLWindow.create(caps); + + window.setSize(640, 480); + window.addGLEventListener(new GLEventListener() { + public void reshape( + final GLAutoDrawable drawable, + final int x, + final int y, + final int width, + final int height) + { + // Nothing. + } + + public void init( + final GLAutoDrawable drawable) + { + final GLContext context = drawable.getContext(); + System.err.println("CTX: "+context.getGLVersion()); + + final GL2GL3 gl = drawable.getGL().getGL2GL3(); + System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR)); + System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER)); + System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION)); + System.err.println("GL Renderer Quirks:" + gl.getContext().getRendererQuirks().toString()); + + final int[] name = new int[] { 0 }; + gl.glGenBuffers(1, name, 0); + Assert.assertTrue(gl.glGetError() == GL.GL_NO_ERROR); + + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, name[0]); + Assert.assertTrue(gl.glGetError() == 0); + gl.glBufferData(GL.GL_ARRAY_BUFFER, 4 * 32, null, GL.GL_STATIC_DRAW); + Assert.assertTrue(gl.glGetError() == 0); + + Assert.assertTrue(gl.glGetBoundBuffer(GL.GL_ARRAY_BUFFER) == name[0]); + gl.glEnableVertexAttribArray(1); + Assert.assertTrue(gl.glGetError() == GL.GL_NO_ERROR); + gl.glVertexAttribPointer(1, 4, GL.GL_FLOAT, false, 0, 0L); + Assert.assertTrue(gl.glGetError() == GL.GL_NO_ERROR); // FIXME On Mesa 9.0.1 w/ GL 3.1 -> GL.GL_INVALID_OPERATION ? + } + + public void dispose( + final GLAutoDrawable drawable) + { + // Nothing. + } + + public void display( + final GLAutoDrawable drawable) + { + // Nothing. + } + }); + + try { + window.setVisible(true); + } finally { + window.destroy(); + } + } + + public static void main(String args[]) { + org.junit.runner.JUnitCore.main(TestGLMesaBug658NEWT.class.getName()); + } + +} + |