Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLSLCompat.glsllib doesn't compile on Android #2329

Open
nickidebruyn opened this issue Nov 17, 2024 · 5 comments
Open

GLSLCompat.glsllib doesn't compile on Android #2329

nickidebruyn opened this issue Nov 17, 2024 · 5 comments
Labels
Android bug Something that is supposed to work, but doesn't. More severe than a "defect".

Comments

@nickidebruyn
Copy link

nickidebruyn commented Nov 17, 2024

While test jme3.7.0 with my android projects I found that the jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib
code contains ';' semicolons at the end of the first few lines and android is not happy with that.

Error I am experiencing:

ERROR: 0:11: ';' : Syntax error:  syntax error
INTERNAL ERROR: no main() function!
ERROR: 1 compilation errors.  No code generated.                                                                                                    
                                                                                                    	at com.jme3.renderer.opengl.GLRenderer.updateShaderSourceData(GLRenderer.java:1658)
                                                                                                    	at com.jme3.renderer.opengl.GLRenderer.updateShaderData(GLRenderer.java:1685)
                                                                                                    	at com.jme3.renderer.opengl.GLRenderer.setShader(GLRenderer.java:1750)

After some more investigation I found that the first part is the problem:

#ifdef GL_ES
  #ifdef FRAGMENT_SHADER
    precision highp float;
    precision highp int;
    precision highp sampler2DArray;
    precision highp sampler2DShadow;
    precision highp samplerCube;
    precision highp sampler3D;
    precision highp sampler2D;
    #if __VERSION__ >= 310
      precision highp sampler2DMS;
    #endif
  #endif
#endif
@nickidebruyn nickidebruyn added the defect Something that is supposed to work, but doesn't. Less severe than a "bug" label Nov 17, 2024
@stephengold
Copy link
Member

Thanks for documenting the issue, @nickidebruyn!

@stephengold stephengold changed the title GLSLCompat.glsllib contains ';' at the end of the first few line and Android is not happe with it GLSLCompat.glsllib doesn't compile on Android Nov 17, 2024
@stephengold
Copy link
Member

According to "git blame", the failing code was last modified by PR #2217, which was integrated between v3.7.0-alpha2 and v3.7.0-beta1.

@nickidebruyn Do your Android projects work with JME v3.7.0-alpha2 ?

@nickidebruyn
Copy link
Author

I tested a few scenarios for this. I can confirm that none of the new version (v3.7.0-alpha2, v3.7.0-beta1, v3.7.0-stable) works.
I then tested again with v3.6.1 and it worked again.
After that I changed back to v3.7.0-stable and created my own local GLSLCompat.glsllib and changed the frag shader to point to that and it worked again. This is the code I removed from my local: GLSLCompat.glsllib

#ifdef GL_ES
  #ifdef FRAGMENT_SHADER
    precision highp float;
    precision highp int;
    precision highp sampler2DArray;
    precision highp sampler2DShadow;
    precision highp samplerCube;
    precision highp sampler3D;
    precision highp sampler2D;
    #if __VERSION__ >= 310
      precision highp sampler2DMS;
    #endif
  #endif
#endif

@stephengold
Copy link
Member

Thank you for the investigation.
Based on your findings, I'm convinced PR #2061 caused the regression.
At the time (August 2023), Riccardo indicated 2061 would need to be tested on Android.
Apparently it never got such testing, and neither did JME 3.7!
I think this calls for a 3.7.1 release...

@nickidebruyn
Copy link
Author

Agree, that is probably a good decision.
Most shaders uses that lib.

@stephengold stephengold added bug Something that is supposed to work, but doesn't. More severe than a "defect". and removed defect Something that is supposed to work, but doesn't. Less severe than a "bug" labels Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android bug Something that is supposed to work, but doesn't. More severe than a "defect".
Projects
None yet
Development

No branches or pull requests

2 participants