[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    Shader issue: #extension repeated in shader
From:       Johan Vos <johan.vos () gluonhq ! com>
Date:       2015-12-30 12:33:42
Message-ID: CABxFH2HPYO8ze9uMTdQN=ergK+WaDRohGoq5zXDd5AxCbkyq8w () mail ! gmail ! com
[Download RAW message or body]

When upgrading a Nexus 6 from Android 5.1.1 to Android 6, the JavaFX 3D
stopped working.
The relevant error is this:

java.lang.RuntimeException: Error creating fragment shader
in
com.sun.prism.es2.ES2Shader.createFromSource

The shader compilation failed with this error:
GLSL compile error:  Extension directives must occur before any
non-preprocessor tokens.
which occurs in

When debugging this, it seems the fragment shader passed
to glCtx.compileShader is created by ES2PhongShader.getShader() which
starts from main1Light.frag and which will do a replaceAll for a number of
statements which will replace those statements with other shader code that
also contains an #extension directive.

As a result, the resulting shader source contains a number of identical
#extension directives. It seems the latest drivers on Android are much more
strict in compiling shaders, and they complain about the position of the
extension directives.

It seems to me some post-processing needs to be done on the result of the
replaceAll() statements when creating the fragment shader in
ES2PhongShader.getShader(ES2MeshView meshView, ES2Context context)

I did a quick and dirty workaround for this in the 8u-dev-tree on
javafxports:
https://bitbucket.org/javafxports/8u-dev-rt/commits/a84eb188c73ff60b68c016f14b6ebf85449a6bbe

With this patch, JavaFX 3D works again on Android, but it is not the best
post-processing solution.

Another solution might be to remove the extension directives from the
individual files in glsl and add them at the end of the processing chain?

- Johan
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic