On Mon, 4 Aug 2025 10:46:37 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:

>> ### Description
>> This is the implementation of new graphics rendering pipeline for JavaFX 
>> using Metal APIs on MacOS.
>> We released two Early Access (EA) builds and have reached a stage where it 
>> is ready to be integrated.
>> Default rendering pipeline on macOS has not been changed by this PR. OpenGL 
>> still stays as the default rendering pipeline and Metal rendering pipeline 
>> is optional to choose (by providing  `-Dprism.order=mtl`)
>> The `-Dprism.verbose=true` option can be used to verify the rendering 
>> pipeline in use.
>> 
>> ### Details about the changes
>> 
>> **Shader changes**
>> - MSLBackend class: This is the primary class that parses (Prism and Decora) 
>> jsl shaders into Metal shaders(msl)
>> - There are a few additional Metal shader files added under directory : 
>> modules/javafx.graphics/src/main/native-prism-mtl/msl
>> 
>> **Build changes** - There are new tasks added to build.gradle for
>> - Generation/ Compilation/ linking of Metal shaders
>> - Compilation of Prism Java and Objective C files
>> 
>> **Prism** - Prism is the rendering engine of JavaFX.
>> - Added Metal specific Java classes and respective native implementation 
>> which use Metal APIs
>> - Java side changes:
>>   - New Metal specific classes: Classes prefixed with MTL, are added here : 
>> modules/javafx.graphics/src/main/java/com/sun/prism/mtl 
>>   - Modification to Prism common classes: A few limited changes were 
>> required in Prism common classes to support Metal classes. 
>> - Native side changes:
>>   - New Metal specific Objective C implementation is added here: 
>> modules/javafx.graphics/src/main/native-prism-mtl
>> 
>> **Glass** - Glass is the windowing toolkit of JavaFX
>> - Existing Glass classes are refactored to support both OpenGL and Metal 
>> pipelines
>> - Added Metal specific Glass implementation.
>> 
>> ### Testing
>> - Testing performed on different hardware and macOS versions.
>>   - HW - macBooks with Intel, Intel with discrete graphics card, Apple 
>> Silicon (M1, M2 and M4)
>>   - macOS versions - macOS 13, macOS 14 and macOS 15
>> - Functional Testing:
>>   - All headful tests pass with Metal pipeline.
>>   - Verified samples applications: Ensemble and toys
>> - Performance Testing:
>>   - Tested with RenderPerfTest: Almost all tests match/exceed es2 
>> performance except a few that fall a little short on different hardwares. 
>> These will be addressed separately (there are open bugs already filed)
>> 
>> ### Note to reviewers :
>> - Providing `-Dprism.order=mtl` option is a must for testing the Metal 
>> pipeline
>> - It woul...
>
> Ambarish Rapte has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   kcr-andy: review comments

I did a quick test build on Windows and I see the following non-fatal error:


> Task :graphics:generateDecoraShaders
Custom actions are attached to task ':graphics:generateDecoraShaders'.
Caching disabled for task ':graphics:generateDecoraShaders' because:
  Build cache is disabled
  Gradle would require more information to cache this task
Task ':graphics:generateDecoraShaders' is not up-to-date because:
  No history is available.
Starting process 'command 'jdk-24.0.2\bin\java.exe''. Working directory: 
jfx\modules\javafx.graphics Command: jdk-24.0.2\bin\java.exe 
--module-path=jfx\modules\javafx.graphics\build\classes\java\main;jfx/modules/javafx.base/build/classes/java/main
 --add-modules=javafx.graphics 
--add-exports=javafx.graphics/com.sun.scenario.effect=ALL-UNNAMED 
--add-exports=javafx.graphics/com.sun.scenario.effect.light=ALL-UNNAMED 
--add-exports=javafx.graphics/com.sun.scenario.effect.impl.state=ALL-UNNAMED 
-Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp 
jfx\modules\javafx.base\build\libs\base.jar;.gradle\caches\modules-2\files-2.1\org.antlr\antlr4\4.7.2\34fc363424d3b060b660f84974a82d6bdc7ebe0c\antlr4-4.7.2-complete.jar;jfx\modules\javafx.graphics\build\classes\java\jslc;jfx\modules\javafx.graphics\src\jslc\resources;jfx\modules\javafx.graphics\build\classes\jsl-compilers\decora
 GenAllDecoraShaders -i jfx\modules\javafx.graphics\src\main\jsl-decora -o 
jfx\modules\javafx.gra
 phics\build\gensrc\jsl-decora -t -pkg com/sun/scenario/effect -all 
GenAllDecoraShaders
Successfully started process 'command 'jdk-24.0.2\bin\java.exe''
IOException occurred while creating FragmentShaderCommon.h: 
jfx\modules\javafx.graphics\build\gensrc\mtl-headers\FragmentShaderCommon.h 
(The system cannot find the path specified)
java.io.FileNotFoundException: 
jfx\modules\javafx.graphics\build\gensrc\mtl-headers\FragmentShaderCommon.h 
(The system cannot find the path specified)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:255)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:210)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:120)
        at java.base/java.io.FileWriter.<init>(FileWriter.java:67)
        at 
com.sun.scenario.effect.compiler.backend.hw.MSLBackend.writeFragmentShaderHeader(MSLBackend.java:498)
        at 
com.sun.scenario.effect.compiler.backend.hw.MSLBackend.setShaderNameAndHeaderPath(MSLBackend.java:470)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:234)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:191)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:158)
        at CompileJSL.main(CompileJSL.java:75)
        at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:565)
        at GenAllDecoraShaders.main(GenAllDecoraShaders.java:53)
An error occurred.
java.io.FileNotFoundException: 
jfx\modules\javafx.graphics\build\gensrc\mtl-headers\DecoraShaderCommon.h (The 
system cannot find the path specified)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:255)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:210)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:120)
        at java.base/java.io.FileWriter.<init>(FileWriter.java:67)
        at 
com.sun.scenario.effect.compiler.backend.hw.MSLBackend.updateCommonHeaders(MSLBackend.java:314)
        at 
com.sun.scenario.effect.compiler.backend.hw.MSLBackend.getShader(MSLBackend.java:429)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:236)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:191)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:158)
        at CompileJSL.main(CompileJSL.java:75)
        at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:565)
        at GenAllDecoraShaders.main(GenAllDecoraShaders.java:53)
An error occurred.
...  (repeated many times)

> Task :graphics:generatePrismShaders
Custom actions are attached to task ':graphics:generatePrismShaders'.
Caching disabled for task ':graphics:generatePrismShaders' because:
  Build cache is disabled
  Gradle would require more information to cache this task
Task ':graphics:generatePrismShaders' is not up-to-date because:
  No history is available.
Starting process 'command 'jdk-24.0.2\bin\java.exe''. Working directory: 
jfx\modules\javafx.graphics Command: jdk-24.0.2\bin\java.exe 
-Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp 
jfx\modules\javafx.base\build\libs\base.jar;.gradle\caches\modules-2\files-2.1\org.antlr\antlr4\4.7.2\34fc363424d3b060b660f84974a82d6bdc7ebe0c\antlr4-4.7.2-complete.jar;jfx\modules\javafx.graphics\build\classes\java\jslc;jfx\modules\javafx.graphics\src\jslc\resources\com\sun\scenario\effect\compiler\backend\prism\PrismGlue.stg;jfx\modules\javafx.graphics\src\jslc\resources\com\sun\scenario\effect\compiler\backend\sw\java\JSWGlue.stg;jfx\modules\javafx.graphics\src\jslc\resources\com\sun\scenario\effect\compiler\backend\sw\me\MEJavaGlue.stg;jfx\modules\javafx.graphics\src\jslc\resources\com\sun\scenario\effect\compiler\backend\sw\me\MENativeGlue.stg;jfx\modules\javafx.graphics\src\jslc\resources\com\sun\scenario\effect\compiler\backend\sw\sse\SSEJavaGlue.stg;jfx\modules\javafx
 
.graphics\src\jslc\resources\com\sun\scenario\effect\compiler\backend\sw\sse\SSENativeGlue.stg;jfx\modules\javafx.graphics\build\classes\jsl-compilers\prism;jfx\modules\javafx.graphics\src\main\jsl-prism
 CompileJSL -i jfx\modules\javafx.graphics\src\main\jsl-prism -o 
jfx\modules\javafx.graphics\build\gensrc\jsl-prism -t -pkg com/sun/prism -d3d 
-es2 -mtl -name jfx\modules\javafx.graphics\src\main\jsl-prism\MaskAlphaOne.jsl
Successfully started process 'command 'jdk-24.0.2\bin\java.exe''
IOException occurred while creating FragmentShaderCommon.h: 
jfx\modules\javafx.graphics\build\gensrc\mtl-headers\FragmentShaderCommon.h 
(The system cannot find the path specified)
java.io.FileNotFoundException: 
jfx\modules\javafx.graphics\build\gensrc\mtl-headers\FragmentShaderCommon.h 
(The system cannot find the path specified)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:255)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:210)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:120)
        at java.base/java.io.FileWriter.<init>(FileWriter.java:67)
        at 
com.sun.scenario.effect.compiler.backend.hw.MSLBackend.writeFragmentShaderHeader(MSLBackend.java:498)
        at 
com.sun.scenario.effect.compiler.backend.hw.MSLBackend.setShaderNameAndHeaderPath(MSLBackend.java:470)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:234)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:191)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:151)
        at CompileJSL.compileShader(CompileJSL.java:422)
        at CompileJSL.compileShader(CompileJSL.java:414)
        at CompileJSL.compileColorPaint(CompileJSL.java:248)
        at CompileJSL.main(CompileJSL.java:481)
An error occurred.
java.io.FileNotFoundException: 
jfx\modules\javafx.graphics\build\gensrc\mtl-headers\PrismShaderCommon.h (The 
system cannot find the path specified)
        at java.base/java.io.FileOutputStream.open0(Native Method)
        at java.base/java.io.FileOutputStream.open(FileOutputStream.java:255)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:210)
        at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:120)
        at java.base/java.io.FileWriter.<init>(FileWriter.java:67)
        at 
com.sun.scenario.effect.compiler.backend.hw.MSLBackend.updateCommonHeaders(MSLBackend.java:314)
        at 
com.sun.scenario.effect.compiler.backend.hw.MSLBackend.getShader(MSLBackend.java:429)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:236)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:191)
        at com.sun.scenario.effect.compiler.JSLC.compile(JSLC.java:151)
        at CompileJSL.compileShader(CompileJSL.java:422)
        at CompileJSL.compileShader(CompileJSL.java:414)
        at CompileJSL.compileColorPaint(CompileJSL.java:248)
        at CompileJSL.main(CompileJSL.java:481)
An error occurred.
...  (repeated many times)

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

PR Comment: https://git.openjdk.org/jfx/pull/1824#issuecomment-3151365650

Reply via email to