This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

This very simple shader fails to link on only some Mali GPUs

Some of our shaders fail to 'link' on some specific devices with Mali GPUs. These shaders have not failed on any non Mali GPU in at least last 13 months. On analyzing our debug logs we found that all of our shader failures in last few months are from Mali GPU devices only. Some of these devices report Android 6.0 as their OS, so they are not running very old software.

Some of the GPUs which fail: Mali-T624, Mali-T628, Mali-T720, Mali-T760 and Mali-T860.

Some of the Android devices which fail: Aqua 4G+, SM-J120A, SM-J200M, SM-T800, CP8298_I00, CRR-L09, E5506, F3216, F670S, P1ma40, SM-G903W, SM-G920P, SM-J120A, SM-J200GU, SM-J200M, SM-J700F, SM-J700M, TAB 2 A8-50F, Z820, SM-A510F

It is interesting that shaders work fine on some devices with these same GPUs and fail to link on other devices with same GPUs, I guess it could be due to different GPU driver versions etc...

 

I have tried the offline compiler using different parameters, but that succeeds as expected. Compiling succeeds on actual devices too, it is the linking which fails.

Here is the simplest of our shaders that fails to link. The shader compiler and linker logs are empty.

Here is the shader source, including the 'additions' done to shader code by cocos2dx game engine, We don't really use those extra uniforms added by cocos as we are not attaching these shaders to a cocos2dx object but its part of the final strings sent to GPU to be compiled and linked.

Vertex Shader:

precision highp float;
 precision highp int;
uniform mat4 CC_PMatrix;
uniform mat4 CC_MVMatrix;
uniform mat4 CC_MVPMatrix;
uniform mat3 CC_NormalMatrix;
uniform vec4 CC_Time;
uniform vec4 CC_SinTime;
uniform vec4 CC_CosTime;
uniform vec4 CC_Random01;
uniform sampler2D CC_Texture0;
uniform sampler2D CC_Texture1;
uniform sampler2D CC_Texture2;
uniform sampler2D CC_Texture3;
//CC INCLUDES END


        attribute vec4 a_position;
        attribute vec2 a_texCoord;
        varying vec2 v_texCoord;
        void main() {
            gl_Position = a_position;
            v_texCoord = a_texCoord;
        }

Fragment Shader:

precision mediump float;
 precision mediump int;
uniform mat4 CC_PMatrix;
uniform mat4 CC_MVMatrix;
uniform mat4 CC_MVPMatrix;
uniform mat3 CC_NormalMatrix;
uniform vec4 CC_Time;
uniform vec4 CC_SinTime;
uniform vec4 CC_CosTime;
uniform vec4 CC_Random01;
uniform sampler2D CC_Texture0;
uniform sampler2D CC_Texture1;
uniform sampler2D CC_Texture2;
uniform sampler2D CC_Texture3;
//CC INCLUDES END


        varying vec2 v_texCoord;
        uniform sampler2D texture0;
        void main() {
            vec4 color = texture2D(texture0, v_texCoord);
            color.rgb *= color.w;
            color.a = 1.0;
            gl_FragColor = color;
        }

 

We have already spent more than a week digging into why this could be, but we don't have a device which would fail. Only debug logs from an app published on play store. We can really use some help here.