From cb7d13948812d51ac0fdab95cebb086ca01e87bc Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Sat, 5 Sep 2015 13:55:59 -0400 Subject: [PATCH] GLSLCompat: support GLES compatibility --- .../Common/MatDefs/Misc/Unshaded.frag | 2 +- .../Common/MatDefs/Misc/Unshaded.vert | 2 +- .../Common/ShaderLib/GLSL150Compat.glsllib | 14 -------- .../Common/ShaderLib/GLSLCompat.glsllib | 34 +++++++++++++++++++ 4 files changed, 36 insertions(+), 16 deletions(-) delete mode 100644 jme3-core/src/main/resources/Common/ShaderLib/GLSL150Compat.glsllib create mode 100644 jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib diff --git a/jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.frag b/jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.frag index 73df8d740..e615d8f1e 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.frag +++ b/jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.frag @@ -1,4 +1,4 @@ -#import "Common/ShaderLib/GLSL150Compat.glsllib" +#import "Common/ShaderLib/GLSLCompat.glsllib" #if defined(HAS_GLOWMAP) || defined(HAS_COLORMAP) || (defined(HAS_LIGHTMAP) && !defined(SEPARATE_TEXCOORD)) #define NEED_TEXCOORD1 diff --git a/jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.vert b/jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.vert index 454708d92..ba7899ca5 100644 --- a/jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.vert +++ b/jme3-core/src/main/resources/Common/MatDefs/Misc/Unshaded.vert @@ -1,4 +1,4 @@ -#import "Common/ShaderLib/GLSL150Compat.glsllib" +#import "Common/ShaderLib/GLSLCompat.glsllib" #import "Common/ShaderLib/Skinning.glsllib" #import "Common/ShaderLib/Instancing.glsllib" diff --git a/jme3-core/src/main/resources/Common/ShaderLib/GLSL150Compat.glsllib b/jme3-core/src/main/resources/Common/ShaderLib/GLSL150Compat.glsllib deleted file mode 100644 index 87f07a3f5..000000000 --- a/jme3-core/src/main/resources/Common/ShaderLib/GLSL150Compat.glsllib +++ /dev/null @@ -1,14 +0,0 @@ -#if __VERSION__ >= 130 -out vec4 outFragColor; -# define texture1D texture -# define texture2D texture -# define texture3D texture -# define texture2DLod texture -# if defined VERTEX_SHADER -# define varying out -# define attribute in -# elif defined FRAGMENT_SHADER -# define varying in -# define gl_FragColor outFragColor -# endif -#endif \ No newline at end of file diff --git a/jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib b/jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib new file mode 100644 index 000000000..3a3173997 --- /dev/null +++ b/jme3-core/src/main/resources/Common/ShaderLib/GLSLCompat.glsllib @@ -0,0 +1,34 @@ +#if defined _GL_ES_ +# define hfloat highp float +# define hvec2 highp vec2 +# define hvec3 highp vec3 +# define hvec4 highp vec4 +# define lfloat lowp float +# define lvec2 lowp vec2 +# define lvec3 lowp vec3 +# define lvec4 lowp vec4 +#else +# define hfloat float +# define hvec2 vec2 +# define hvec3 vec3 +# define hvec4 vec4 +# define lfloat float +# define lvec2 vec2 +# define lvec3 vec3 +# define lvec4 vec4 +#endif + +#if __VERSION__ >= 130 +out vec4 outFragColor; +# define texture1D texture +# define texture2D texture +# define texture3D texture +# define texture2DLod texture +# if defined VERTEX_SHADER +# define varying out +# define attribute in +# elif defined FRAGMENT_SHADER +# define varying in +# define gl_FragColor outFragColor +# endif +#endif \ No newline at end of file