Android OpenGL ES 3.0 Unity fails

I have and OpenGL ES 3.0 project and when loading on Android 4.3 (Nexus4) i got:

I/Unity   (19744): gles_mode = 3 (integer)
I/Unity   (19744): splash_mode = 0 (integer)
I/Unity   (19744): hide_status_bar = True (bool)
I/Unity   (19744): 32bit_display = True (bool)
I/Unity   (19744): 24bit_depth = True (bool)
I/Unity   (19744): default_aa = 0 (integer)
I/Unity   (19744): useObb = False (bool)
I/Unity   (19744): development_player = True (bool)
I/Unity   (19744): onResume
I/Unity   (19744): windowFocusChanged: true
D/Unity   (19744): surfaces: attach glview
I/Unity   (19744): onResume
D/Unity   (19744): Creating OpenGL ES 2.0 context (RGB24 888 24/8)
I/Unity   (19744): windowFocusChanged: true
I/Unity   (19744): onSurfaceCreated
I/Unity   (19744): onSurfaceChanged 768x1184
I/Unity   (19744): view is 768x1184
I/Unity   (19744): initUnity
I/Unity   (19744): glGetString (GL10.GL_VERSION)='OpenGL ES 3.0 V@14.0 (GIT@Iabe52cfaeae4c5fab1acacfe6f056ba15fa93274)'
D/Unity   (19744): SystemInfo CPU = ARMv7 VFPv3 NEON, Cores = 4, Memory = 1870mb

Why is creating OpenGL ES 2.0 context ?

later when shader gets compiled i got following error:

D/Unity   (19744): -------- GLSL source:
D/Unity   (19744): #extension GL_EXT_shadow_samplers : enable
D/Unity   (19744): precision highp float;
D/Unity   (19744): varying highp vec4 xlv_TEXCOORD3;
D/Unity   (19744): varying lowp vec3 xlv_TEXCOORD2;
D/Unity   (19744): varying lowp vec3 xlv_TEXCOORD1;
D/Unity   (19744): varying highp vec2 xlv_TEXCOORD0;
D/Unity   (19744): uniform lowp vec4 _Color;
D/Unity   (19744): uniform sampler2D _MainTex;
D/Unity   (19744): uniform lowp sampler2DShadow _ShadowMapTexture;
D/Unity   (19744): uniform lowp vec4 _LightColor0;
D/Unity   (19744): uniform highp vec4 _LightShadowData;
D/Unity   (19744): uniform lowp vec4 _WorldSpaceLightPos0;
D/Unity   (19744): void main ()
D/Unity   (19744): {
D/Unity   (19744):   lowp vec4 c_1;
D/Unity   (19744):   lowp vec4 tmpvar_2;
D/Unity   (19744):   tmpvar_2 = (texture2D (_MainTex, xlv_TEXCOORD0) * _Color);
D/Unity   (19744):   lowp float shadow_3;
D/Unity   (19744):   lowp float tmpvar_4;
D/Unity   (19744):   tmpvar_4 = shadow2DEXT (_ShadowMapTexture, xlv_TEXCOORD3.xyz);
D/Unity   (19744):   highp float tmpvar_5;
D/Unity   (19744):   tmpvar_5 = (_LightShadowData.x + (tmpvar_4 * (1.0 - _LightShadowData.x)));
D/Unity   (19744):   shadow_3 = tmpvar_5;
D/Unity   (19744):   lowp vec4 c_6;
D/Unity   (19744):   c_6.xyz = ((tmpvar_2.xyz * _LightColor0.xyz) * ((max (0.0, dot (xlv_TEXCOORD1, _WorldSpaceLightPos0.xyz)) * shadow_3) * 2.0));
D/Unity   (19744):   c_6.w = tmpvar_2.w;
D/Unity   (19744):   c_1.w = c_6.w;
D/Unity   (19744):   c_1.xyz = (c_6.xyz + (tmpvar_2.xyz * xlv_TEXCOORD2));
D/Unity   (19744):   gl_FragData[0] = c_1;
D/Unity   (19744): }
D/Unity   (19744): -------- GLSL error:
D/Unity   (19744): Fragment shader compilation failed.
D/Unity   (19744): WARNING: 0:6: extension 'GL_EXT_shadow_samplers' is not supported
D/Unity   (19744): ERROR: 0:14: 'sampler2DShadow' : Reserved word.
D/Unity   (19744): ERROR: 0:14: 'sampler2DShadow' : Syntax error:  syntax error
D/Unity   (19744): ERROR: 2 compilation errors.  No code generated.
D/Unity   (19744):
D/Unity   (19744):
D/Unity   (19744):
D/Unity   (19744): GLES30: failed to compile fragment shader:

Any settings I missed in Unity ?

Thank you for helping,
Domi

I’m seeing the same issue. I’m using a Qualcomm Snapdragon 8974 Development tablet running Android 4.2.2. All of the Adreno SDK OpenGL 3.0 samples run fine on my device.

Any help would be appreciated. thanks!

j

I’m seeing the same for Galaxy S4

eglConfig should be giving you a GL3.0 context automatically. In fact you are probably requesting or Unity could be requesting a 2.0 glContext simply for searching better shader compability but, if it is possible, egl will always return 3.0 if available. eglConfig settings are minimal settings in Android and when calling the eglChooseConfig will return the best possible config for the device. Then as you can see here:

The selected GL version seems to be 3.0 as expected in this device and Android version.

The point with Nexus 4 is that it has no support for GL_EXT_shadow_samplers extension, so you can not use shadow samplers for self-shadowing. You need to use depth textures or colour depth textures methods for doing it.

You can take a look for supported extensions here:

http://gfxbench.com/device.jsp?benchmark=gfx27&D=Google+Nexus+4&testgroup=gl

And as you can see the GL3.0 version driver is exactly the same that Unity is returning to you:

To RelentlessLouis Galaxy S4 has the same problem as Nexus4 not supporting this extension:

http://gfxbench.com/device.jsp?benchmark=gfx27&D=Samsung+GT-I9295+Galaxy+S4+Active&testgroup=gl

And to Joel Pritchett check your device extensions in that page. It could be the same :wink: Although if I remember well I would say that GL3.0 was activated in Android since version 4.3. So if you are trying to use GL3.0 code before 4.3 I think it wont work properly.