javajavafxmetalopenjfx

Does JavaFX use the new Metal-based rendering for Java on macOS?


Do the latest versions (19, 20, etc.) of JavaFX/OpenJFX use the new Metal rendering built for Java on macOS, supplanting OpenGL?

JEP 382: New macOS Rendering Pipeline

That new pipeline became the default in Java 19.


Solution

  • No. JavaFX, as of 20, does not use the Apple Metal API.

    For hardware acceleration on Mac, JavaFX uses OpenGL ES2. It can also fall back to a software renderer, but you have to force it to do that, it will use ES2 by default.

    There is experimental proof of concept work using the Apple Metal API for JavaFX 3D rendering. The implementation can be found in this pull request on the jfx-sandbox repository (this is not the mainline repository that is used for JavaFX releases):

    The metal branch in the sandbox has a lot of fairly recent changes:

    Perhaps in the future, Metal support will be added to JavaFX.

    If you have further queries, raise the topic on the openjfx-dev mailing list.

    Main issue tracker for JavaFX Metal support:


    The work done for Metal support on Mac for the JDK as part of JEP 382, as far as I can tell, is only for the Java2D API. The Java2D API (as far as I know) is not used by JavaFX, except perhaps to help with printing support. The Java2D work to support metal can be used by AWT and Swing frameworks that are part of the core JDK. JavaFX is no longer part of the JDK, so the JEP process does not apply to it.