Skip to content

Default shader version selection to GLSL300 for GLES3#2819

Merged
riccardobl merged 2 commits into
jMonkeyEngine:masterfrom
riccardobl:gles3shaderselection
May 28, 2026
Merged

Default shader version selection to GLSL300 for GLES3#2819
riccardobl merged 2 commits into
jMonkeyEngine:masterfrom
riccardobl:gles3shaderselection

Conversation

@riccardobl
Copy link
Copy Markdown
Member

@riccardobl riccardobl commented May 27, 2026

JME shader version default ( GLSL100 ) selects the minimum glsl version available in the platform.

The problem is that in GLES3 it defaults to GLSL100 (GLES2) for every shader that is not specifically hinted to GLSL300, this means that GLSL>=150 && GLSL < 300 shaders that would otherwise run fine in GLES3 are downgraded to GLES2 and break.

GLES2 is not supported anymore and, after the recent updates to the engine, GLES3.0 is guaranteed in every platform, so having to deal with GLES2 and all its quirkiness just to support a lower default is not worth.

This PR move the default to GLSL300 when using a GLES backend.

If a shader is written with the old syntax, after this PR it needs to import GLSLCompat.glsllib, but this technically already the case in jme, since without GLSLCompat the shader will not work properly anyway.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the GLSL shader versioning logic in GLRenderer.java to support GLES3, upgrading versions between 150 and 300 to 300, and forcing #version 300 es for older shaders under GLES3. However, forcing GLSL 100 shaders to compile under #version 300 es will cause compilation failures due to deprecated keywords like attribute and varying which are unsupported in GLSL ES 3.00. Additionally, using String.valueOf(version) inside StringBuilder.append() is redundant and should be simplified to avoid unnecessary string allocations.

Comment thread jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
Comment thread jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java Outdated
@riccardobl riccardobl changed the title Default shader version selection to GLES3 for GLES3 Default shader version selection to GLSL300 for GLES3 May 27, 2026
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@yaRnMcDonuts yaRnMcDonuts added this to the v3.10.0 milestone May 27, 2026
@riccardobl riccardobl merged commit 8cfd642 into jMonkeyEngine:master May 28, 2026
25 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants