DoCompileShader: Failed to compile shader

Game seems to crash when played on low end device due to a shader error. I have attached the logs from low as well as high end devices in the google drive link. Please help me out with this issue.

https://drive.google.com/drive/folders/1Wq8e27l3ClQVg-TjiYuH7rvtqGpdGCM7?usp=sharing

Can you reproduce the issue in Chrome in a new project with the same shader?

What information can you provide about the device? Specs, OS version etc

It looks like this is the error but can you confirm please?

2022-11-25 21:15:32.503 6545-6576/? E/chromium: [ERROR:shader_manager.cc(133)] Shader translator allowed/produced an invalid shader unless the driver is buggy:
    --Log from shader translator--
    
    --original-shader--
    #version 300 es
    precision highp float;
    precision highp sampler2DShadow;
    
    
    #define varying in
    out highp vec4 pc_fragColor;
    #define gl_FragColor pc_fragColor
    #define texture2D texture
    #define texture2DBias texture
    #define textureCube texture
    #define texture2DProj textureProj
    #define texture2DLodEXT textureLod
    #define texture2DProjLodEXT textureProjLod
    #define textureCubeLodEXT textureLod
    #define texture2DGradEXT textureGrad
    #define texture2DProjGradEXT textureProjGrad
    #define textureCubeGradEXT textureGrad
    
    #define textureShadow(res, uv) textureGrad(res, uv, vec2(1, 1), vec2(1, 1))
    
    #define GL2
    #define SUPPORTS_TEXLOD
    #define SHADER_NAME LitShader
    #define LIT_SPECULAR
    #define LIT_SPECULAR_FRESNEL
    #define LIT_CONSERVE_ENERGY
    varying vec3 vPositionW;
    varying vec3 vNormalW;
    varying vec2 vUv0;
    
    uniform vec3 view_position;
    
    uniform vec3 light_globalAmbient;
    
    float square(float x) {
        return x*x;
    }
    
    float saturate(float x) {
        return clamp(x, 0.0, 1.0);
    }
    
    vec3 saturate(vec3 x) {
        return clamp(x, vec3(0.0), vec3(1.0));
    }
    
    vec3 detailMode_mul(vec3 c1, vec3 c2) {
        return c1 * c2;
    }
    
    vec3 detailMode_add(vec3 c1, vec3 c2) {
        return c1 + c2;
    }
    
    
    vec3 detailMode_screen(vec3 c1, vec3 c2) {
        return 1.0 - (1.0 - c1)*(1.0 - c2);
    }
    
    
    vec3 detailMode_overlay(vec3 c1, vec3 c2) {
        return mix(1.0 - 2.0*(1.0 - c1)*(1.0 - c2), 2.0*c1*c2, step(c1, vec3(0.5)));
    }
    
    vec3 detailMode_min(vec3 c1, vec3 c2) {
        return min(c1, c2);
    }
    
    vec3 detailMode_max(vec3 c1, vec3 c2) {
        return max(c1, c2);
    }
    vec4 dReflection;
    mat3 dTBN;
    vec3 dVertexNormalW;
    vec3 dViewDirW;
    vec3 dReflDirW;
    vec3 dHalfDirW;
    vec3 dDiffuseLight;
    vec3 dSpecularLight;
    vec3 dLightDirNormW;
    vec3 dLightDirW;
    vec3 dLightPosW;
    vec3 dShadowCoord;
    float dAtten;
    float dAttenD;
    vec3 dAtten3;
    float ccFresnel;
    vec3 ccReflection;
    vec3 ccSpecularLight;
    vec3 sSpecularLight;
    vec3 sReflection;
    uniform float textureBias;
    float dAlpha;
    vec3 dNormalW;
    vec3 dAlbedo;
    vec3 dSpecularity;
    float dGlossiness;
    vec3 dEmission;
    uniform sampler2D texture_opacityMap;
    
    float getSpotEffect(vec3 lightSpotDirW, float lightInnerConeAngle, float lightOuterConeAngle) {
        float cosAngle = dot(dLightDirNormW, lightSpotDirW);
        return smoothstep(lightOuterConeAngle, lightInnerConeAngle, cosAngle);
    }
    
    float getFalloffWindow(float lightRadius) {
        float sqrDist = dot(dLightDirW, dLightDirW);
        float invRadius = 1.0 / lightRadius;
        return square( saturate( 1.0 - square( sqrDist * square(invRadius) ) ) );
    }
    
    float getFalloffInvSquared(float lightRadius) {
        float sqrDist = dot(dLightDirW, dLightDirW);
        float falloff = 1.0 / (sqrDist + 1.0);
        float invRadius = 1.0 / lightRadius;
    
        falloff *= 16.0;
        falloff *= square( saturate( 1.0 - square( sqrDist * square(invRadius) ) ) );
    
        return falloff;
    }
    
    float getFalloffLinear(float lightRadius) {
        float d = length(dLightDirW);
        return max(((lightRadius - d) / lightRadius), 0.0);
    }
    
    void getLightDirPoint(vec3 lightPosW) {
        dLightDirW = vPositionW - lightPosW;
        dLightDirNormW = normalize(dLightDirW);
        dLightPosW = lightPosW;
    }
    #define AREA_R8_G8_B8_A8_LUTS
    #define AREA_LIGHTS
    uniform lowp sampler2D areaLightsLutTex1;
    uniform lowp sampler2D areaLightsLutTex2;
    uniform vec3 light0_color;
    uniform vec3 light0_direction;
    
    
    
    const float PI = 3.141592653589793;
    
    vec2 toSpherical(vec3 dir) {
        return vec2(dir.xz == vec2(0.0) ? 0.0 : atan(dir.x, dir.z), asin(dir.y));
    }
    
    vec2 toSphericalUv(vec3 dir) {
        vec2 uv = toSpherical(dir) / vec2(PI * 2.0, PI) + 0.5;
        return vec2(uv.x, 1.0 - uv.y);
    }
    
    vec3 decodeLinear(vec4 raw) {
        return raw.rgb;
    }
    
    float decodeGamma(float raw) {
        return pow(raw, 2.2);
    }
    
    vec3 decodeGamma(vec3 raw) {
        return pow(raw, vec3(2.2));
    }
    
    vec3 decodeGamma(vec4 raw) {
        return pow(raw.xyz, vec3(2.2));
    }
    
    vec3 decodeRGBM(vec4 raw) {
        vec3 color = (8.0 * raw.a) * raw.rgb;
        return color * color;
    }
    
    vec3
2022-11-25 21:15:32.881 6362-6385/? I/zygote: Background concurrent copying GC freed 43645(1719KB) AllocSpace objects, 1(80KB) LOS objects, 24% free, 5MB/7MB, paused 297us total 227.994ms
2022-11-25 21:15:32.989 6545-6576/? E/IMGSRV: :0: DoCompileShader: Failed to compile shader
2022-11-25 21:15:32.990 6545-6576/? E/chromium: [ERROR:shader_manager.cc(133)] Shader translator allowed/produced an invalid shader unless the driver is buggy:
    --Log from shader translator--
    
    --original-shader--
    #version 300 es
    precision highp float;
    precision highp sampler2DShadow;
    
    
    #define varying in
    out highp vec4 pc_fragColor;
    #define gl_FragColor pc_fragColor
    #define texture2D texture
    #define texture2DBias texture
    #define textureCube texture
    #define texture2DProj textureProj
    #define texture2DLodEXT textureLod
    #define texture2DProjLodEXT textureProjLod
    #define textureCubeLodEXT textureLod
    #define texture2DGradEXT textureGrad
    #define texture2DProjGradEXT textureProjGrad
    #define textureCubeGradEXT textureGrad
    
    #define textureShadow(res, uv) textureGrad(res, uv, vec2(1, 1), vec2(1, 1))
    
    #define GL2
    #define SUPPORTS_TEXLOD
    #define SHADER_NAME LitShader
    #define LIT_SPECULAR
    #define LIT_SPECULAR_FRESNEL
    #define LIT_CONSERVE_ENERGY
    varying vec3 vPositionW;
    varying vec3 vNormalW;
    varying vec2 vUv0;
    
    uniform vec3 view_position;
    
    uniform vec3 light_globalAmbient;
    
    float square(float x) {
        return x*x;
    }
    
    float saturate(float x) {
        return clamp(x, 0.0, 1.0);
    }
    
    vec3 saturate(vec3 x) {
        return clamp(x, vec3(0.0), vec3(1.0));
    }
    
    vec3 detailMode_mul(vec3 c1, vec3 c2) {
        return c1 * c2;
    }
    
    vec3 detailMode_add(vec3 c1, vec3 c2) {
        return c1 + c2;
    }
    
    
    vec3 detailMode_screen(vec3 c1, vec3 c2) {
        return 1.0 - (1.0 - c1)*(1.0 - c2);
    }
    
    
    vec3 detailMode_overlay(vec3 c1, vec3 c2) {
        return mix(1.0 - 2.0*(1.0 - c1)*(1.0 - c2), 2.0*c1*c2, step(c1, vec3(0.5)));
    }
    
    vec3 detailMode_min(vec3 c1, vec3 c2) {
        return min(c1, c2);
    }
    
    vec3 detailMode_max(vec3 c1, vec3 c2) {
        return max(c1, c2);
    }
    vec4 dReflection;
    mat3 dTBN;
    vec3 dVertexNormalW;
    vec3 dViewDirW;
    vec3 dReflDirW;
    vec3 dHalfDirW;
    vec3 dDiffuseLight;
    vec3 dSpecularLight;
    vec3 dLightDirNormW;
    vec3 dLightDirW;
    vec3 dLightPosW;
    vec3 dShadowCoord;
    float dAtten;
    float dAttenD;
    vec3 dAtten3;
    float ccFresnel;
    vec3 ccReflection;
    vec3 ccSpecularLight;
    vec3 sSpecularLight;
    vec3 sReflection;
    uniform float textureBias;
    float dAlpha;
    vec3 dNormalW;
    vec3 dAlbedo;
    vec3 dSpecularity;
    float dGlossiness;
    vec3 dEmission;
    uniform sampler2D texture_opacityMap;
    
    float getSpotEffect(vec3 lightSpotDirW, float lightInnerConeAngle, float lightOuterConeAngle) {
        float cosAngle = dot(dLightDirNormW, lightSpotDirW);
        return smoothstep(lightOuterConeAngle, lightInnerConeAngle, cosAngle);
    }
    
    float getFalloffWindow(float lightRadius) {
        float sqrDist = dot(dLightDirW, dLightDirW);
        float invRadius = 1.0 / lightRadius;
        return square( saturate( 1.0 - square( sqrDist * square(invRadius) ) ) );
    }
    
    float getFalloffInvSquared(float lightRadius) {
        float sqrDist = dot(dLightDirW, dLightDirW);
        float falloff = 1.0 / (sqrDist + 1.0);
        float invRadius = 1.0 / lightRadius;
    
        falloff *= 16.0;
        falloff *= square( saturate( 1.0 - square( sqrDist * square(invRadius) ) ) );
    
        return falloff;
    }
    
    float getFalloffLinear(float lightRadius) {
        float d = length(dLightDirW);
        return max(((lightRadius - d) / lightRadius), 0.0);
    }
    
    void getLightDirPoint(vec3 lightPosW) {
        dLightDirW = vPositionW - lightPosW;
        dLightDirNormW = normalize(dLightDirW);
        dLightPosW = lightPosW;
    }
    #define AREA_R8_G8_B8_A8_LUTS
    #define AREA_LIGHTS
    uniform lowp sampler2D areaLightsLutTex1;
    uniform lowp sampler2D areaLightsLutTex2;
    uniform vec3 light0_color;
    uniform vec3 light0_direction;
    
    
    
    const float PI = 3.141592653589793;
    
    vec2 toSpherical(vec3 dir) {
        return vec2(dir.xz == vec2(0.0) ? 0.0 : atan(dir.x, dir.z), asin(dir.y));
    }
    
    vec2 toSphericalUv(vec3 dir) {
        vec2 uv = toSpherical(dir) / vec2(PI * 2.0, PI) + 0.5;
        return vec2(uv.x, 1.0 - uv.y);
    }
    
    vec3 decodeLinear(vec4 raw) {
        return raw.rgb;
    }
    
    float decodeGamma(float raw) {
        return pow(raw, 2.2);
    }
    
    vec3 decodeGamma(vec3 raw) {
        return pow(raw, vec3(2.2));
    }
    
    vec3 decodeGamma(vec4 raw) {
        return pow(raw.xyz, vec3(2.2));
    }
    
    vec3 decodeRGBM(vec4 raw) {
        vec3 color = (8.0 * raw.a) * raw.rgb;
        return color * color;
    }
    
    vec3

@yaustar Yes this is the error.

Can you provide the above please?

These logs were taken in chrome only. Here are the specs about the device on which the error occurred.

Can you provide a public project that reproducies the crash in that device please?

@yaustar I made this project for my company . It has private assets that are important for me to reproduce this issue in a public project. How could I help you else wise?

@yaustar could it be due to the following post processing scripts that I am using in my project which could be not supportive in low end devices?

https://drive.google.com/drive/folders/1LGuSPc62MbLN0-y6HMppY2dbrEijQspi?usp=sharing

When I have these types of issues, normally I look at isolating what is causing the issue.

First step is to see how little I can leave in the scene for the issue to happen. Eg if I delete all the scripts, does it still happen? If I delete half the entities does it still happen? Etc

Once I’ve got the bare minimum, then it I try replacing the assets and textures to placeholders to see if it still happens.

Usually when I go through this process, it can be a small scene without private assets.

Can’t really help without having a reproducible on our end unfortunately. The logs from before is showing the full shader code which doesn’t help too much

@yaustar Here is the screen shot of the error occuring on the playcanvas editor while I am launching the game from the low end android device (vivo) for which I shared the specs you asked for.

@yaustar

I think I have debugged the issue. Apparently for some reason, transparent materials throws this bug for low end devices. Also post processing effects break the game due to FPS drop while playing the game. I would update the build and get back to you.

Issue got fixed when we updated the model from transparent material into a low poly model for the low end devices.

Happy to hear that you got the issue fixed.

Now that you know what the issue is, would you be able to create a small public reproducible project (without private assets) so that we can investigate the cause please?

sure will do that