From 209bb2f0dc3418d168dc6887802bf4368b6d6f4e Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 21 Aug 2019 02:19:20 +0200 Subject: Bug 1384: Allow GLRendererQuirks to be overridden by user properties Allow GLRendererQuirks to be overridden by user properties, allowing to either force (inject) a quirk by a user property or to ignore a quirk by a user property. This helps: - debugging certain quirk behavior (See Bug 1383) - allowing a user to customize the quirk setting +++ This patch also refines the quirk: GLNonCompliant -> GL3CompatNonCompliant, i.e. constraints its semantics to GL3 compatible context. +++ This patch also removed useless code of GLRendererQuirk, i.e. the 'int[] quirk' array arguments which are nonsense or wasteful, as we operate with bitmasks. --- .../com/jogamp/opengl/GLRendererQuirks.java | 191 ++++++++++++++------- 1 file changed, 125 insertions(+), 66 deletions(-) (limited to 'src/jogl/classes/com/jogamp') diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index 7898566f3..d7f27f643 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -27,15 +27,19 @@ */ package com.jogamp.opengl; +import java.lang.reflect.Field; import java.util.IdentityHashMap; import com.jogamp.nativewindow.AbstractGraphicsDevice; import com.jogamp.opengl.GLCapabilitiesImmutable; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.egl.EGL; import com.jogamp.opengl.egl.EGLExt; +import jogamp.opengl.Debug; + /** * GLRendererQuirks contains information of known bugs of various GL renderer. * This information allows us to workaround them. @@ -47,8 +51,44 @@ import com.jogamp.opengl.egl.EGLExt; * Some GL_VENDOR and GL_RENDERER strings are * listed here . *

+ *

+ * For testing purpose or otherwise, you may override the implemented + * quirk bit setting behavior using {@link GLRendererQuirks.Override}. + *

*/ public class GLRendererQuirks { + /** + * Allow overriding any quirk settings + * via the two properties: + * + * Both contain a list of capital sensitive quirk names separated by comma. + * Example: + *
+     * java -Djogl.quirks.force=GL3CompatNonCompliant,NoFullFBOSupport -cp my_classpath some.main.Class
+     * 
+ *

+ * Naturally, one quirk can only be listed in one override list. + * Hence the two override sets force and ignore are unique. + *

+ */ + public static enum Override { + /** + * No override. + */ + NONE, + /** + * Enforce the quirk, i.e. allowing the code path to be injected w/o actual cause. + */ + FORCE, + /** + * Ignore the quirk, i.e. don't set the quirk if otherwise caused. + */ + IGNORE + } + /** * Crashes XServer when using double buffered PBuffer with GL_RENDERER: *