Skip to content

Commit e2ffd8b

Browse files
Copilotriccardobl
andauthored
Add GL_ES precision qualifiers to Glsl150ShaderGenerator for GLES3 compatibility (jMonkeyEngine#2634)
* Initial plan * Fix: Add GL_ES precision qualifiers in Glsl150ShaderGenerator for GLES3 support Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: riccardobl <4943530+riccardobl@users.noreply.github.com>
1 parent d8da788 commit e2ffd8b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

jme3-core/src/main/java/com/jme3/shader/Glsl150ShaderGenerator.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,20 @@ private void generateCompatibilityDefines(StringBuilder source, ShaderType type)
8989
//Adding compatibility defines, as it's more efficient than replacing the function calls in the source code
9090
if (type == ShaderType.Fragment) {
9191
source.append("\n")
92+
.append("#ifdef GL_ES\n")
93+
.append("precision highp float;\n")
94+
.append("precision highp int;\n")
95+
.append("#if __VERSION__ >= 130\n")
96+
.append("precision highp sampler2DArray;\n")
97+
.append("#endif\n")
98+
.append("precision highp sampler2DShadow;\n")
99+
.append("precision highp samplerCube;\n")
100+
.append("precision highp sampler3D;\n")
101+
.append("precision highp sampler2D;\n")
102+
.append("#if __VERSION__ >= 310\n")
103+
.append("precision highp sampler2DMS;\n")
104+
.append("#endif\n")
105+
.append("#endif\n")
92106
.append("#define texture1D texture\n")
93107
.append("#define texture2D texture\n")
94108
.append("#define texture3D texture\n")

0 commit comments

Comments
 (0)