From 269f626f98e9a3edaf70ea67545d7456cbbf02b7 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 7 Oct 2019 18:27:24 -0400 Subject: [PATCH] incorporate https://github.com/processing/processing/pull/5881 for FBO fix on Intel HD Graphics 3000 devices --- core/src/processing/opengl/PGL.java | 11 +++++++++++ core/src/processing/opengl/PSurfaceJOGL.java | 17 +++++++++++++++++ core/todo.txt | 13 ++++++++----- todo.txt | 2 +- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index e78d0236e..467dd0730 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -165,6 +165,17 @@ public abstract class PGL { protected boolean usingFrontTex = false; protected boolean needSepFrontTex = false; + /** + * Defines if FBO Layer is allowed in the given environment. + * Using FBO can cause a fatal error during runtime for + * Intel HD Graphics 3000 chipsets (commonly used on older MacBooks) + * #4104 + * The value remains as 'true' unless set false during init. + * TODO There's already code in here to enable/disable the FBO properly, + * this should be making use of that mechanism instead. [fry 191007] + */ + protected boolean fboAllowed = true; + // ........................................................ // Texture rendering diff --git a/core/src/processing/opengl/PSurfaceJOGL.java b/core/src/processing/opengl/PSurfaceJOGL.java index 460033ada..2b3896982 100644 --- a/core/src/processing/opengl/PSurfaceJOGL.java +++ b/core/src/processing/opengl/PSurfaceJOGL.java @@ -36,6 +36,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.lang.reflect.Method; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; @@ -178,6 +179,22 @@ public class PSurfaceJOGL implements PSurface { GraphicsConfiguration config = awtDisplayDevice.getDefaultConfiguration(); displayRect = config.getBounds(); + + /** See explanation at {@link PGL#fboAllowed} in PGL */ + if (PApplet.platform == PConstants.MACOS) { + try { + Class cglClass = Class.forName("sun.java2d.opengl.CGLGraphicsConfig"); + Method cglMethod = cglClass.getMethod("getContextCapabilities"); + Class ctcClass = Class.forName("sun.java2d.pipe.hw.ContextCapabilities"); + Method ctcMethod = ctcClass.getMethod("getAdapterId"); + Object cglInstance = cglClass.cast(config); + Object ctcInstance = cglMethod.invoke(cglInstance); + Object idInstance = ctcMethod.invoke(ctcInstance); + if (String.valueOf(idInstance).contains("Intel HD Graphics 3000")) { + pgl.fboAllowed = false; + } + } catch (Exception e) { } + } } diff --git a/core/todo.txt b/core/todo.txt index 44ad048f9..a5f4af95a 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,4 +1,9 @@ -0270 (3.5.4 or 3.6) +1270 (4.x alpha) +X check for disabling FBO code (fixes Intel HD 3000) +X https://github.com/processing/processing/issues/4104 +X https://github.com/processing/processing/pull/5881 + + _ size() issues on Mojave? (3.4 works, 3.5.3 does not) _ https://github.com/processing/processing/issues/5791 _ use exit event to set mouseY to 0 on macOS @@ -11,12 +16,10 @@ _ simple rotateZ() fix _ https://github.com/processing/processing/pull/5821 _ https://github.com/processing/processing/issues/5770 -_ check for disabling FBO code (fixes Intel HD 3000) -_ https://github.com/processing/processing/issues/4104 -_ https://github.com/processing/processing/pull/5881 - high-ish +_ Update isAccessible() in Table to use JDK 11 reflection methods +_ https://github.com/processing/processing4/issues/3 _ add separator option to loadTable() _ https://github.com/processing/processing/issues/5068 _ make setting the window icon automatic, based on files in local dirs diff --git a/todo.txt b/todo.txt index b2dae5e96..2012713b0 100755 --- a/todo.txt +++ b/todo.txt @@ -1,4 +1,4 @@ -0270 (4.x) +1270 (4.x alpha) X use ctrl-page up/down for tabs on Windows X https://github.com/processing/processing/issues/5794 X fix potential highlighting issue that wasn't selecting portions of text