RFR: 8258754: Gracefully fallback to the OpenGL rendering pipeline if Metal rendering pipeline initialization fails

Sergey Bylokhov serb at openjdk.java.net
Thu Jan 7 06:38:13 UTC 2021


On Wed, 6 Jan 2021 11:05:56 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:

> This implements fallback to the OpenGL rendering pipeline if Metal rendering pipeline initialization fails.
> I have tested this fallback on 10.15.4 by stubbing code. We need real testing on a system where Metal is not available.

src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java line 506:

> 504:         // flush the OGL pipeline (this is a no-op if OGL is not enabled)
> 505:         if (CGraphicsDevice.useMetalPipeline()) {
> 506:             MTLRenderQueue.sync();

Does this check mean that the MTLRenderQueue.sync() is not a noop if the metal is not enabled?

src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java line 71:

> 69: 
> 70:         // Check whether -Dsun.java2d.metal=true has been specified
> 71:         if (MacOSFlags.isMetalEnabled()) {

Is it possible to use metal and OGL at the same time on different devices? I think it is better to move these checks to the CGraphicsEnvironment.makeScreenDevice(), similar Win32GraphicsEnvironment.makeScreenDevice()

-------------

PR: https://git.openjdk.java.net/lanai/pull/147


More information about the lanai-dev mailing list