diff --git a/src/java.desktop/macosx/classes/sun/java2d/MacOSFlags.java b/src/java.desktop/macosx/classes/sun/java2d/MacOSFlags.java index 5e09d39692b..37b573a339b 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/MacOSFlags.java +++ b/src/java.desktop/macosx/classes/sun/java2d/MacOSFlags.java @@ -125,16 +125,7 @@ public class MacOSFlags { System.out.println("Could not enable OpenGL pipeline (CGL not available)"); } oglEnabled = false; - metalEnabled = MTLGraphicsConfig.isMetalAvailable(); - } - } else if (metalEnabled && !oglEnabled) { - // Check whether Metal framework is available - if (!MTLGraphicsConfig.isMetalAvailable()) { - if (metalVerbose) { - System.out.println("Could not enable Metal pipeline (Metal framework not available)"); - } - metalEnabled = false; - oglEnabled = CGLGraphicsConfig.isCGLAvailable(); + metalEnabled = true; } } diff --git a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java index 64117b8999e..8a992361b96 100644 --- a/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java +++ b/src/java.desktop/macosx/classes/sun/java2d/metal/MTLGraphicsConfig.java @@ -72,7 +72,6 @@ import static sun.java2d.metal.MTLContext.MTLContextCaps.CAPS_EXT_BIOP_SHADER; public final class MTLGraphicsConfig extends CGraphicsConfig implements AccelGraphicsConfig, SurfaceManager.ProxiedGraphicsConfig { - private static boolean mtlAvailable; private static ImageCapabilities imageCaps = new MTLImageCaps(); @SuppressWarnings("removal") @@ -89,7 +88,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig private final Object disposerReferent = new Object(); private final int maxTextureSize; - private static native boolean isMetalFrameworkAvailable(); private static native boolean tryLoadMetalLibrary(int displayID, String shaderLib); private static native long getMTLConfigInfo(int displayID, String mtlShadersLib); @@ -99,10 +97,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig */ private static native int nativeGetMaxTextureSize(); - static { - mtlAvailable = isMetalFrameworkAvailable(); - } - private MTLGraphicsConfig(CGraphicsDevice device, long configInfo, int maxTextureSize, ContextCapabilities mtlCaps) { @@ -133,10 +127,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig public static MTLGraphicsConfig getConfig(CGraphicsDevice device, int displayID) { - if (!mtlAvailable) { - return null; - } - if (!tryLoadMetalLibrary(displayID, mtlShadersLib)) { return null; } @@ -171,10 +161,6 @@ public final class MTLGraphicsConfig extends CGraphicsConfig return new MTLGraphicsConfig(device, cfginfo, textureSize, caps); } - public static boolean isMetalAvailable() { - return mtlAvailable; - } - /** * Returns true if the provided capability bit is present for this config. * See MTLContext.java for a list of supported capabilities. diff --git a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m index af6662cecf2..7b165a668b3 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLGraphicsConfig.m @@ -54,22 +54,6 @@ MTLGC_DestroyMTLGraphicsConfig(jlong pConfigInfo) free(mtlinfo); } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_metal_MTLGraphicsConfig_isMetalFrameworkAvailable - (JNIEnv *env, jclass mtlgc) -{ - jboolean metalSupported = JNI_FALSE; - - // It is guaranteed that metal supported GPU is available since macOS 10.14 - if (@available(macOS 10.14, *)) { - metalSupported = JNI_TRUE; - } - - J2dRlsTraceLn1(J2D_TRACE_INFO, "MTLGraphicsConfig_isMetalFrameworkAvailable : %d", metalSupported); - - return metalSupported; -} - JNIEXPORT jboolean JNICALL Java_sun_java2d_metal_MTLGraphicsConfig_tryLoadMetalLibrary (JNIEnv *env, jclass mtlgc, jint displayID, jstring shadersLibName)