From ccdc2ce6805e330cc5555b138044829f4bc67df9 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 16 Jun 2012 21:27:21 +0200 Subject: Fix Bug 590: Wrong GL2 and GLES2 aliasing of GL_ARB_half_float_pixel/GL_ARB_half_float_vertex and GL_OES_texture_half_float extensions We mistakenly aliase the GL2 and GLES2 extensions: - GL_ARB_half_float_pixel - GL_HALF_FLOAT_ARB 0x140B - GL_ARB_half_float_vertex - GL_HALF_FLOAT 0x140B - GL_OES_texture_half_float extensions - GL_HALF_FLOAT_OES 0x8D61 This also leads to adding GL_HALF_FLOAT_OES to com.jogamp.opengl.util.GLBuffers.sizeof(..). --- make/config/jogl/gl-common-extensions.cfg | 1 - make/config/jogl/gl-if-CustomJavaCode-gl.java | 3 ++ make/config/jogl/gl-if-gl-ignores.cfg | 44 +++++---------------------- make/config/jogl/gl-if-gl2_es2.cfg | 2 ++ 4 files changed, 13 insertions(+), 37 deletions(-) (limited to 'make/config') diff --git a/make/config/jogl/gl-common-extensions.cfg b/make/config/jogl/gl-common-extensions.cfg index 51edd9edd..6631e035d 100644 --- a/make/config/jogl/gl-common-extensions.cfg +++ b/make/config/jogl/gl-common-extensions.cfg @@ -70,7 +70,6 @@ RenameExtensionIntoCore GL_OES_stencil4 RenameExtensionIntoCore GL_OES_stencil8 RenameExtensionIntoCore GL_OES_stencil_wrap RenameExtensionIntoCore GL_OES_texture_cube_map -RenameExtensionIntoCore GL_OES_texture_half_float RenameExtensionIntoCore GL_OES_texture_mirrored_repeat RenameExtensionIntoCore GL_OES_vertex_type_10_10_10_2 RenameExtensionIntoCore GL_EXT_color_buffer_half_float diff --git a/make/config/jogl/gl-if-CustomJavaCode-gl.java b/make/config/jogl/gl-if-CustomJavaCode-gl.java index 4741b2df5..77378aa45 100644 --- a/make/config/jogl/gl-if-CustomJavaCode-gl.java +++ b/make/config/jogl/gl-if-CustomJavaCode-gl.java @@ -53,6 +53,9 @@ public static final int GL_SMOOTH_POINT_SIZE_RANGE = 0x0B12; /** Common in ES1, GL2 and GL3 */ public static final int GL_XOR = 0x1506; + /** Part of GL_ARB_half_float_vertex; GL_NV_half_float; GL_ARB_half_float_pixel, + earmarked for ES 3.0 (hence kept in GL while fixing Bug 590) */ + public static final int GL_HALF_FLOAT = 0x140B; public void glClearDepth( double depth ); diff --git a/make/config/jogl/gl-if-gl-ignores.cfg b/make/config/jogl/gl-if-gl-ignores.cfg index 220bd74bf..25fbd5a6f 100644 --- a/make/config/jogl/gl-if-gl-ignores.cfg +++ b/make/config/jogl/gl-if-gl-ignores.cfg @@ -32,13 +32,19 @@ IgnoreExtension GL_EXT_debug_marker IgnoreExtension GL_EXT_debug_label IgnoreExtension GL_EXT_multisampled_render_to_texture IgnoreExtension GL_EXT_framebuffer_multisample - +IgnoreExtension GL_OES_texture_half_float +IgnoreExtension GL_OES_vertex_half_float # IgnoreExtension GL_EXT_texture_storage IgnoreExtension GL_NV_draw_buffers IgnoreExtension GL_NV_fbo_color_attachments IgnoreExtension GL_OES_vertex_array_object IgnoreExtension GL_OES_texture_3D -# above ext are subsumed, so ignore the aliased ones + +# includes GL_STATE_RESTORE, which hasn't the QCOM suffix +IgnoreExtension GL_QCOM_extended_get +Ignore GL_STATE_RESTORE + +# above ext mightbe subsumed, ignore the aliased ones Ignore GL_ACTIVE_PROGRAM Ignore GL_ALPHA16F Ignore GL_ALPHA32F @@ -156,10 +162,6 @@ Ignore glPushGroupMarkerEXT # isn't included in GL2 Ignore GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET -# includes GL_STATE_RESTORE, which hasn't the QCOM suffix -IgnoreExtension GL_QCOM_extended_get -Ignore GL_STATE_RESTORE - Ignore GL_ACTIVE_ATTRIBUTE_MAX_LENGTH Ignore GL_ACTIVE_ATTRIBUTES Ignore GL_ACTIVE_UNIFORM_MAX_LENGTH @@ -348,36 +350,6 @@ Ignore GL_NORMAL_ARRAY_TYPE Ignore GL_NORMALIZE Ignore GL_NORMAL_MAP_OES Ignore GL_NUM_SHADER_BINARY_FORMATS -Ignore GL_OES_blend_equation_separate -Ignore GL_OES_blend_func_separate -Ignore GL_OES_blend_subtract -Ignore GL_OES_byte_coordinates -Ignore GL_OES_compressed_ETC1_RGB8_texture -Ignore GL_OES_compressed_paletted_texture -Ignore GL_OES_depth24 -Ignore GL_OES_depth32 -Ignore GL_OES_draw_texture -Ignore GL_OES_element_index_uint -Ignore GL_OES_extended_matrix_palette -Ignore GL_OES_fbo_render_mipmap -Ignore GL_OES_fixed_point -Ignore GL_OES_framebuffer_object -Ignore GL_OES_matrix_get -Ignore GL_OES_matrix_palette -Ignore GL_OES_point_size_array -Ignore GL_OES_point_sprite -Ignore GL_OES_query_matrix -Ignore GL_OES_read_format -Ignore GL_OES_single_precision -Ignore GL_OES_stencil1 -Ignore GL_OES_stencil4 -Ignore GL_OES_stencil8 -Ignore GL_OES_stencil_wrap -Ignore GL_OES_texture_cube_map -Ignore GL_OES_texture_env_crossbar -Ignore GL_OES_texture_half_float -Ignore GL_OES_texture_mirrored_repeat -Ignore GL_OES_vertex_half_float Ignore GL_ONE_MINUS_CONSTANT_ALPHA Ignore GL_ONE_MINUS_CONSTANT_COLOR Ignore GL_OPERAND0_ALPHA diff --git a/make/config/jogl/gl-if-gl2_es2.cfg b/make/config/jogl/gl-if-gl2_es2.cfg index 6a8aef06b..85e799298 100644 --- a/make/config/jogl/gl-if-gl2_es2.cfg +++ b/make/config/jogl/gl-if-gl2_es2.cfg @@ -35,6 +35,8 @@ IgnoreExtension GL_EXT_discard_framebuffer IgnoreExtension GL_OES_compressed_paletted_texture IgnoreExtension GL_OES_compressed_ETC1_RGB8_texture IgnoreExtension GL_OES_vertex_array_object +IgnoreExtension GL_OES_texture_half_float +IgnoreExtension GL_OES_vertex_half_float IgnoreExtension GL_OES_EGL_image_external IgnoreExtension GL_EXT_debug_marker IgnoreExtension GL_EXT_debug_label -- cgit v1.2.3 From e85e3ec2a73ac35aaf911f0b1e34b234be1622da Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 6 Jul 2012 01:20:48 +0200 Subject: Enhance Bootsrapping of JOGL around 37% - 40% (1st start in new JVM) - GLProfile and GLContext* GLProfile: Enhance bootsrapping performance of loading GL*Impl class - Offthread classloading of all GL*Impl via reflection at startup reduces startup time here around 12% (800ms down to 700ms). GLContext*: Enhance bootsrapping performance of querying available GL profiles - Add PROFILE_ALIASING mode, defaults to true - can be disabled w/ property 'jogl.debug.GLContext.NoProfileAliasing' - PROFILE_ALIASING: If true (default), bootstrapping the available GL profiles will use the highest compatible GL context for each profile, hence skipping querying lower profiles if a compatible higher one is found. Linux x86_64 - Nvidia: 28%, 700ms down to 500ms Linux x86_64 - AMD : 40%, 1500ms down to 900ms - GL*Impl: - make fields final: glProfile, _context, buffer*Tracker and glStateTracker - allow null _context/glProfile in initialization (bootstrapping) - JoglVersion.getDefaultOpenGLInfo(..) - add arg: 'boolean withCapabilitiesInfo', allowing to suppres the list of caps --- .../config/jogl/gl-impl-CustomJavaCode-common.java | 4 +- make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java | 18 ++-- make/config/jogl/gl-impl-CustomJavaCode-gles1.java | 18 ++-- make/config/jogl/gl-impl-CustomJavaCode-gles2.java | 18 ++-- make/scripts/tests.sh | 5 +- .../classes/com/jogamp/opengl/JoglVersion.java | 16 ++-- .../classes/com/jogamp/opengl/swt/GLCanvas.java | 2 +- src/jogl/classes/javax/media/opengl/GLContext.java | 71 +++++++++++++-- src/jogl/classes/javax/media/opengl/GLProfile.java | 81 +++++++++-------- .../classes/javax/media/opengl/awt/GLCanvas.java | 2 +- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 100 +++++++++++++++++---- .../jogamp/opengl/x11/glx/X11GLXContext.java | 10 +-- .../classes/com/jogamp/newt/opengl/GLWindow.java | 2 +- .../classes/jogamp/newt/driver/android/MD.java | 2 +- .../test/junit/jogl/acore/TestGLProfile01NEWT.java | 2 +- .../junit/jogl/acore/TestShutdownCompleteNEWT.java | 19 ++-- 16 files changed, 261 insertions(+), 109 deletions(-) (limited to 'make/config') diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java index 2c3227ee5..d552bc6e4 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-common.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java @@ -1,7 +1,7 @@ public GLProfile getGLProfile() { return this.glProfile; } - private GLProfile glProfile; + private final GLProfile glProfile; public int glGetBoundBuffer(int target) { return bufferStateTracker.getBoundBufferObject(target, this); @@ -46,7 +46,7 @@ return _context; } - private GLContextImpl _context; + private final GLContextImpl _context; /** * @see javax.media.opengl.GLContext#setSwapInterval(int) diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java index dc4f898e6..95aa7cc2c 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gl4bc.java @@ -17,9 +17,15 @@ public void setObjectTracker(GLObjectTracker tracker) { public GL4bcImpl(GLProfile glp, GLContextImpl context) { this._context = context; - this.bufferSizeTracker = context.getBufferSizeTracker(); - this.bufferStateTracker = context.getBufferStateTracker(); - this.glStateTracker = context.getGLStateTracker(); + if(null != context) { + this.bufferSizeTracker = context.getBufferSizeTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); + } else { + this.bufferSizeTracker = null; + this.bufferStateTracker = null; + this.glStateTracker = null; + } this.glProfile = glp; } @@ -35,9 +41,9 @@ public java.nio.ByteBuffer glAllocateMemoryNV(int arg0, float arg1, float arg2, // Helpers for ensuring the correct amount of texture data // -private GLBufferSizeTracker bufferSizeTracker; -private GLBufferStateTracker bufferStateTracker; -private GLStateTracker glStateTracker; +private final GLBufferSizeTracker bufferSizeTracker; +private final GLBufferStateTracker bufferStateTracker; +private final GLStateTracker glStateTracker; private boolean bufferObjectExtensionsInitialized = false; private boolean haveARBPixelBufferObject; diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java index 9b0d98fe9..dff33cf81 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles1.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles1.java @@ -1,8 +1,14 @@ public GLES1Impl(GLProfile glp, GLContextImpl context) { this._context = context; - this.bufferSizeTracker = context.getBufferSizeTracker(); - this.bufferStateTracker = context.getBufferStateTracker(); - this.glStateTracker = context.getGLStateTracker(); + if(null != context) { + this.bufferSizeTracker = context.getBufferSizeTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); + } else { + this.bufferSizeTracker = null; + this.bufferStateTracker = null; + this.glStateTracker = null; + } this.glProfile = glp; } @@ -106,9 +112,9 @@ public final GL2GL3 getGL2GL3() throws GLException { // Helpers for ensuring the correct amount of texture data // -private GLBufferSizeTracker bufferSizeTracker; -private GLBufferStateTracker bufferStateTracker; -private GLStateTracker glStateTracker; +private final GLBufferSizeTracker bufferSizeTracker; +private final GLBufferStateTracker bufferStateTracker; +private final GLStateTracker glStateTracker; private boolean bufferObjectExtensionsInitialized = false; private boolean haveOESFramebufferObject; diff --git a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java index ea6544d29..a4976f5ea 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-gles2.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-gles2.java @@ -4,9 +4,15 @@ private boolean inBeginEndPair; public GLES2Impl(GLProfile glp, GLContextImpl context) { this._context = context; - this.bufferSizeTracker = context.getBufferSizeTracker(); - this.bufferStateTracker = context.getBufferStateTracker(); - this.glStateTracker = context.getGLStateTracker(); + if(null != context) { + this.bufferSizeTracker = context.getBufferSizeTracker(); + this.bufferStateTracker = context.getBufferStateTracker(); + this.glStateTracker = context.getGLStateTracker(); + } else { + this.bufferSizeTracker = null; + this.bufferStateTracker = null; + this.glStateTracker = null; + } this.glProfile = glp; } @@ -110,9 +116,9 @@ public final GL2GL3 getGL2GL3() throws GLException { // Helpers for ensuring the correct amount of texture data // -private GLBufferSizeTracker bufferSizeTracker; -private GLBufferStateTracker bufferStateTracker; -private GLStateTracker glStateTracker; +private final GLBufferSizeTracker bufferSizeTracker; +private final GLBufferStateTracker bufferStateTracker; +private final GLStateTracker glStateTracker; private boolean bufferObjectExtensionsInitialized = false; private boolean haveOESFramebufferObject; diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 852dd6f25..10890c786 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -53,6 +53,7 @@ function jrun() { swton=$1 shift + #D_ARGS="-Djogl.debug.GLContext.NoProfileAliasing" #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all -Dnewt.debug=all" #D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all" @@ -214,7 +215,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* -#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $* +testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownSharedNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestInitConcurrentNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextSurfaceLockNEWT $* @@ -226,7 +227,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextVBOES2NEWT2 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateNEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitchNEWT $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLContextDrawableSwitchNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT $* diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java index c8e5d212b..75785fd86 100644 --- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java +++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java @@ -93,22 +93,24 @@ public class JoglVersion extends JogampVersion { return sb; } - public static StringBuilder getDefaultOpenGLInfo(StringBuilder sb) { + public static StringBuilder getDefaultOpenGLInfo(StringBuilder sb, boolean withCapabilitiesInfo) { if(null==sb) { sb = new StringBuilder(); } final AbstractGraphicsDevice device = GLProfile.getDefaultDevice(); - sb.append("Default Profiles ").append(Platform.getNewline()); + sb.append("Default Profiles on device ").append(device).append(Platform.getNewline()); if(null!=device) { GLProfile.glAvailabilityToString(device, sb, "\t", 1); } else { sb.append("none"); } - sb.append(Platform.getNewline()).append(Platform.getNewline()); - sb.append("Desktop Capabilities: ").append(Platform.getNewline()); - getAvailableCapabilitiesInfo(GLDrawableFactory.getDesktopFactory(), device, sb); - sb.append("EGL Capabilities: ").append(Platform.getNewline()); - getAvailableCapabilitiesInfo(GLDrawableFactory.getEGLFactory(), device, sb); + if(withCapabilitiesInfo) { + sb.append(Platform.getNewline()).append(Platform.getNewline()); + sb.append("Desktop Capabilities: ").append(Platform.getNewline()); + getAvailableCapabilitiesInfo(GLDrawableFactory.getDesktopFactory(), device, sb); + sb.append("EGL Capabilities: ").append(Platform.getNewline()); + getAvailableCapabilitiesInfo(GLDrawableFactory.getEGLFactory(), device, sb); + } return sb; } diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index 62b496891..571f5c5b2 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -570,7 +570,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable { // System.err.println(NativeWindowVersion.getInstance()); System.err.println(JoglVersion.getInstance()); - System.err.println(JoglVersion.getDefaultOpenGLInfo(null).toString()); + System.err.println(JoglVersion.getDefaultOpenGLInfo(null, true).toString()); final GLCapabilitiesImmutable caps = new GLCapabilities( GLProfile.getDefault(GLProfile.getDefaultDevice()) ); final Display display = new Display(); diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index ecfa230d2..351f90027 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -43,12 +43,15 @@ package javax.media.opengl; import java.nio.IntBuffer; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; import javax.media.nativewindow.AbstractGraphicsDevice; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; +import com.jogamp.common.os.Platform; import com.jogamp.common.util.IntObjectHashMap; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; @@ -66,6 +69,32 @@ import com.jogamp.common.util.locks.RecursiveLock; abstraction provides a stable object which clients can use to refer to a given context. */ public abstract class GLContext { + /** + * If true (default), bootstrapping the available GL profiles + * will use the highest compatible GL context for each profile, + * hence skipping querying lower profiles if a compatible higher one is found: + * + * Otherwise the dedicated GL context would be queried and used: + * + * Using aliasing speeds up initialization about: + *

- +

+

Another implementation detail is the drawable reconfiguration. One use case is where a window is being dragged to another screen with a different pixel configuration, ie {@link GLCapabilities}. The implementation - shall be able to detect such cases in conjunction with the associated {@link javax.media.nativewindow.NativeSurface NativeSurface}.
+ shall be able to detect such cases in conjunction with the associated {@link javax.media.nativewindow.NativeSurface NativeSurface}.
For example, AWT's {@link java.awt.Canvas} 's {@link java.awt.Canvas#getGraphicsConfiguration getGraphicsConfiguration()} is capable to determine a display device change. This is demonstrated within {@link javax.media.opengl.awt.GLCanvas}'s and NEWT's AWTCanvas {@link javax.media.opengl.awt.GLCanvas#getGraphicsConfiguration getGraphicsConfiguration()} specialization. Another demonstration is NEWT's {@link javax.media.nativewindow.NativeWindow NativeWindow} - implementation on the Windows platform, which utilizes the native platform's MonitorFromWindow(HWND) function.
+ implementation on the Windows platform, which utilizes the native platform's MonitorFromWindow(HWND) function.
All OpenGL resources shall be regenerated, while the drawable's {@link GLCapabilities} has - to be choosen again. The following protocol shall be satisfied. + to be chosen again. The following protocol shall be satisfied.