filament icon indicating copy to clipboard operation
filament copied to clipboard

Shader compile error on some Adreno (TM) 30* Phones

Open kaelsass opened this issue 7 years ago • 2 comments

Describe the bug Android demo has no effect on some Qualcomm Adreno (TM) 30* GPU phones. These are some shader compile errors in the logcat:

08-22 17:46:49.093 20329-20350/? E/Filament: COMPILE ERROR: 
08-22 17:46:49.093 20329-20350/? E/Filament: Fragment shader compilation failed.
    ERROR: 0:93: 'Error' : Cannot offset into the vector 
    ERROR: 0:93: 'Error' : Cannot offset into the vector 
    ERROR: 0:93: '=' :  cannot convert from '3-component vector of float' to 'float'
    ERROR: 0:96: 'Error' : Cannot offset into the vector 
    ERROR: 0:96: 'Error' : Cannot offset into the vector 
    ERROR: 0:96: 'Error' : Cannot offset into the vector 
    ERROR: 0:96: 'constructor' : too many arguments 
    ERROR: 0:96: 'Error' : Cannot offset into the vector 
    ERROR: 0:96: '*' :  w
08-22 17:46:49.093 20329-20350/? E/Filament: 1:   #version 300 es
08-22 17:46:49.093 20329-20350/? E/Filament: 2:   precision mediump float;
08-22 17:46:49.093 20329-20350/? E/Filament: 3:   precision mediump int;
08-22 17:46:49.093 20329-20350/? E/Filament: 4:   struct MaterialInputs
08-22 17:46:49.093 20329-20350/? E/Filament: 5:   {
08-22 17:46:49.093 20329-20350/? E/Filament: 6:   vec4 baseColor;
08-22 17:46:49.093 20329-20350/? E/Filament: 7:   vec4 emissive;
08-22 17:46:49.093 20329-20350/? E/Filament: 8:   float clearCoat;
08-22 17:46:49.093 20329-20350/? E/Filament: 9:   float clearCoatRoughness;
08-22 17:46:49.093 20329-20350/? E/Filament: 10:   float anisotropy;
08-22 17:46:49.093 20329-20350/? E/Filament: 11:   vec3 anisotropyDirection;
08-22 17:46:49.093 20329-20350/? E/Filament: 12:   };
08-22 17:46:49.093 20329-20350/? E/Filament: 13:   const vec3 _206[16] = vec3[](vec3(-0.40120899677276611328125, 0.9159870147705078125, 0.031720198690891265869140625), vec3(0.84313297271728515625, -0.537703990936279296875, 0.087920702993869781494140625), vec3(0.4575429856777191162109375, 0.889187991619110107421875, 0.01769370026886463165283203125), vec3(0.976761996746063232421875, -0.21432499587535858154296875, 0.093010701239109039306640625), vec3(-0.05964539945125579833984375, 0.998220026493072509765625, 0.026174999773502349853515625), vec3(0.704176008701324462890625, 0.710025012493133544921875, 0.107385002076625823974609375), vec3(-0.707961022853851318359375, 0.70625102519989013671875, 0.03754340112209320068359375), vec3(0.9094259738922119140625, 0.4158659875392913818359375, 0.102259002625942230224609375), vec3(0.924619972705841064453125, 0.38089001178741455078125, 0.0063620698638260364532470703125), vec3(-0.09386239945888519287109375, 0.995585024356842041015625, 0.0267156995832920074462890625), vec3(-0.905196011066436767578125, -0.4249930083751678466796875, 0.0562839992344379425048828125), vec3(0.19610400497913360595703125, 0.980583012104034423828125, 0.115615002810955047607421875), vec3(-0.7520020008087158203125, -0.65916097164154052734375, 0.0605199001729488372802734375), vec3(-0.575920999050140380859375, 0.81750500202178955078125, 0.1269100010395050048828125), vec3(0.7945950031280517578125, -0.607140004634857177734375, 0.086689300835132598876953125), vec3(0.1788440048694610595703125, 0.983877003192901611328125, 0.115860998630523681640625));
08-22 17:46:49.093 20329-20350/? E/Filament: 14:   const vec3 _347[7] = vec3[](vec3(0.9663259983062744140625, 0.257322013378143310546875, 0.0769231021404266357421875), vec3(-0.697179973125457763671875, 0.716895997524261474609375, 0.23076899349689483642578125), vec3(0.975223004817962646484375, 0.2212260067462921142578125, 0.384615004062652587890625), vec3(0.982770979404449462890625, 0.18482600152492523193359375, 0.538461983203887939453125), vec3(-0.6130549907684326171875, 0.79004001617431640625, 0.692308008670806884765625), vec3(0.997237026691436767578125, 0.074288897216320037841796875, 0.8461539745330810546875), vec3(1.0, -1.1602700169532909058034420013428e-06, 1.0));
08-22 17:46:49.093 20329-20350/? E/Filament: 15:   layout(std140) uniform FrameUniforms
08-22 17:46:49.093 20329-20350/? E/Filament: 16:   {
08-22 17:46:49.093 20329-20350/? E/Filament: 17:   highp mat4 viewFromWorldMatrix;
08-22 17:46:49.093 20329-20350/? E/Filament: 18:   highp mat4 worldFromViewMatrix;
08-22 17:46:49.093 20329-20350/? E/Filament: 19:   highp mat4 clipFromViewMatrix;
08-22 17:46:49.093 20329-20350/? E/Filament: 20:   highp mat4 viewFromClipMatrix;
08-22 17:46:49.093 20329-20350/? E/Filament: 21:   highp mat4 clipFromWorldMatrix;
08-22 17:46:49.093 20329-20350/? E/Filament: 22:   highp mat4 worldFromClipMatrix;
08-22 17:46:49.093 20329-20350/? E/Filament: 23:   highp mat4 lightFromWorldMatrix;
08-22 17:46:49.093 20329-20350/? E/Filament: 24:   highp vec4 resolution;
08-22 17:46:49.093 20329-20350/? E/Filament: 25:   highp vec3 cameraPosition;
08-22 17:46:49.093 20329-20350/? E/Filament: 26:   highp float time;
08-22 17:46:49.093 20329-20350/? E/Filament: 27:   vec4 lightColorIntensity;
08-22 17:46:49.093 20329-20350/? E/Filament: 28:   vec4 sun;
08-22 17:46:49.093 20329-20350/? E/Filament: 29:   vec3 lightDirection;
08-22 17:46:49.093 20329-20350/? E/Filament: 30:   uint fParamsX;
08-22 17:46:49.093 20329-20350/? E/Filament: 31:   vec3 shadowBias;
08-22 17:46:49.093 20329-20350/? E/Filament: 32:   float oneOverFroxelDimensionY;
08-22 17:46:49.093 20329-20350/? E/Filament: 33:   vec4 zParams;
08-22 17:46:49.093 20329-20350/? E/Filament: 34:   uvec2 fParams;
08-22 17:46:49.093 20329-20350/? E/Filament: 35:   vec2 origin;
08-22 17:46:49.093 20329-20350/? E/Filament: 36:   float oneOverFroxelDimension;
08-22 17:46:49.093 20329-20350/? E/Filament: 37:   float iblLuminance;
08-22 17:46:49.093 20329-20350/? E/Filament: 38:   float exposure;
08-22 17:46:49.093 20329-20350/? E/Filament: 39:   float ev100;
08-22 17:46:49.093 20329-20350/? E/Filament: 40:   vec3 iblSH[9];
08-22 17:46:49.093 20329-20350/? E/Filament: 41:   vec4 userTime;
08-22 17:46:49.093 20329-20350/? E/Filament: 42:   vec2 iblMaxMipLevel;
08-22 17:46:49.093 20329-20350/? E/Filament: 43:   vec2 padding0;
08-22 17:46:49.093 20329-20350/? E/Filament: 44:   vec4 padding1[16];
08-22 17:46:49.093 20329-20350/? E/Filament: 45:   } frameUniforms;
08-22 17:46:49.093 20329-20350/? E/Filament: 46:   layout(std140) uniform MaterialParams
08-22 17:46:49.093 20329-20350/? E/Filament: 47:   {
08-22 17:46:49.093 20329-20350/? E/Filament: 48:   vec4 resolution;
08-22 17:46:49.093 20329-20350/? E/Filament: 49:   float radius;
08-22 17:46:49.093 20329-20350/? E/Filament: 50:   float invRadiusSquared;
08-22 17:46:49.093 20329-20350/? E/Filament: 51:   float projectionScaleRadius;
08-22 17:46:49.093 20329-20350/? E/Filament: 52:   float bias;
08-22 17:46:49.093 20329-20350/? E/Filament: 53:   float power;
08-22 17:46:49.093 20329-20350/? E/Filament: 54:   int maxLevel;
08-22 17:46:49.093 20329-20350/? E/Filament: 55:   } materialParams;
08-22 17:46:49.093 20329-20350/? E/Filament: 56:   uniform highp sampler2D materialParams_depth;
08-22 17:46:49.093 20329-20350/? E/Filament: 57:   in highp vec3 vertex_worldPosition;
08-22 17:46:49.093 20329-20350/? E/Filament: 58:   in highp vec4 variable_vertex;
08-22 17:46:49.093 20329-20350/? E/Filament: 59:   layout(location = 0) out vec4 fragColor;
08-22 17:46:49.093 20329-20350/? E/Filament: 60:   MaterialInputs _1148;
08-22 17:46:49.093 20329-20350/? E/Filament: 61:   vec2 _1155;
08-22 17:46:49.093 20329-20350/? E/Filament: 62:   void main()
08-22 17:46:49.093 20329-20350/? E/Filament: 63:   {
08-22 17:46:49.093 20329-20350/? E/Filament: 64:   MaterialInputs _1100 = _1148;
08-22 17:46:49.093 20329-20350/? E/Filament: 65:   _1100.baseColor = vec4(1.0);
08-22 17:46:49.093 20329-20350/? E/Filament: 66:   highp float _712 = -frameUniforms.clipFromViewMatrix[3].z;
08-22 17:46:49.093 20329-20350/? E/Filament: 67:   highp float _718 = _712 / min(-5.9604644775390625e-08, ((texture(materialParams_depth, variable_vertex.xy, 0.0).x * 2.0) - 1.0) + frameUniforms.clipFromViewMatrix[2].z);
08-22 17:46:49.093 20329-20350/? E/Filament: 68:   vec2 _727 = (variable_vertex.xy * 2.0) - vec2(1.0);
08-22 17:46:49.093 20329-20350/? E/Filament: 69:   highp vec2 _1108 = _1155;
08-22 17:46:49.093 20329-20350/? E/Filament: 70:   _1108.x = _727.x * frameUniforms.viewFromClipMatrix[0].x;
08-22 17:46:49.093 20329-20350/? E/Filament: 71:   highp vec2 _1112 = _1108;
08-22 17:46:49.093 20329-20350/? E/Filament: 72:   _1112.y = _727.y * frameUniforms.viewFromClipMatrix[1].y;
08-22 17:46:49.093 20329-20350/? E/Filament: 73:   highp vec3 _748 = vec3(_1112 * (-_718), _718);
08-22 17:46:49.093 20329-20350/? E/Filament: 74:   vec2 _766 = variable_vertex.xy + vec2(materialParams.resolution.z, 0.0);
08-22 17:46:49.093 20329-20350/? E/Filament: 75:   vec2 _770 = variable_vertex.xy + vec2(0.0, materialParams.resolution.w);
08-22 17:46:49.093 20329-20350/? E/Filament: 76:   highp float _807 = _712 / min(-5.9604644775390625e-08, ((texture(materialParams_depth, _766, 0.0).x * 2.0) - 1.0) + frameUniforms.clipFromViewMatrix[2].z);
08-22 17:46:49.093 20329-20350/? E/Filament: 77:   vec2 _816 = (_766 * 2.0) - vec2(1.0);
08-22 17:46:49.093 20329-20350/? E/Filament: 78:   highp vec2 _1118 = _1155;
08-22 17:46:49.093 20329-20350/? E/Filament: 79:   _1118.x = _816.x * frameUniforms.viewFromClipMatrix[0].x;
08-22 17:46:49.093 20329-20350/? E/Filament: 80:   highp vec2 _1122 = _1118;
08-22 17:46:49.093 20329-20350/? E/Filament: 81:   _1122.y = _816.y * frameUniforms.viewFromClipMatrix[1].y;
08-22 17:46:49.093 20329-20350/? E/Filament: 82:   highp float _862 = _712 / min(-5.9604644775390625e-08, ((texture(materialParams_depth, _770, 0.0).x * 2.0) - 1.0) + frameUniforms.clipFromViewMatrix[2].z);
08-22 17:46:49.093 20329-20350/? E/Filament: 83:   vec2 _871 = (_770 * 2.0) - vec2(1.0);
08-22 17:46:49.093 20329-20350/? E/Filament: 84:   highp vec2 _1128 = _1155;
08-22 17:46:49.093 20329-20350/? E/Filament: 85:   _1128.x = _871.x * frameUniforms.viewFromClipMatrix[0].x;
08-22 17:46:49.093 20329-20350/? E/Filament: 86:   highp vec2 _1132 = _1128;
08-22 17:46:49.093 20329-20350/? E/Filament: 87:   _1132.y = _871.y * frameUniforms.viewFromClipMatrix[1].y;
08-22 17:46:49.093 20329-20350/? E/Filament: 88:   uint _911 = (uint(gl_FragCoord.x) & 3u) + ((uint(gl_FragCoord.y) & 3u) * 4u);
08-22 17:46:49.093 20329-20350/? E/Filament: 89:   float _1150;
08-22 17:46:49.093 20329-20350/? E/Filament: 90:   _1150 = 0.0;
08-22 17:46:49.093 20329-20350/? E/Filament: 91:   for (uint _1149 = 0u; _1149 < 7u; )
08-22 17:46:49.093 20329-20350/? E/Filament: 92:   {
08-22 17:46:49.093 20329-20350/? E/Filament: 93:   float _1025 = _347[_1149].z + _206[_911].z;
08-22 17:46:49.093 20329-20350/? E/Filament: 94:   float _1032 = _1025 * _1025;
08-22 17:46:49.093 20329-20350/? E/Filament: 95:   float _940 = max(1.0, _1032 * (-(materialParams.projectionScaleRadius / _718)));
08-22 17:46:49.093 20329-20350/? E/Filament: 96:   ivec2 _946 = ivec2(variable_vertex.xy * materialParams.resolution.xy) + ivec2(vec3(mat2(vec2(_206[_911].xy), vec2(-_206[_911].y, _206[_911].x)) * _347[_1149].xy, _1032).xy * _940);
08-22 17:46:49.093 20329-20350/? E/Filament: 97:   int _961 = clamp(int(floor(log2(_940))) - 3, 0, materialParams.maxLevel);
08-22 17:46:49.093 20329-20350/? E/Filament: 98:   highp float _1061 = _712 / min(-5.9604644775390625e-08, ((texelFetch(materialParams_depth, clamp(_946 >> ivec2(_961), ivec2(0), textureSize(materialParams_depth, _961) - ivec2(1)), _961).x * 2.0) - 1.0) + frameUniforms.clipFromViewMatrix[2].z);
08-22 17:46:49.093 20329-20350/? E/Filament: 99:   vec2 _1070 = (((vec2(_946) + vec2(0.5)) * materialParams.resolution.zw) * 2.0) - vec2(1.0);
08-22 17:46:49.093 20329-20350/? E/Filament: 100:   highp vec2 _1141 = _1155;
08-22 17:46:49.093 20329-20350/? E/Filament: 101:   _1141.x = _1070.x * frameUniforms.viewFromClipMatrix[0].x;
08-22 17:46:49.093 20329-20350/? E/Filament: 102:   highp vec2 _1145 = _1141;
08-22 17:46:49.093 20329-20350/? E/Filament: 103:   _1145.y = _1070.y * frameUniforms.viewFromClipMatrix[1].y;
08-22 17:46:49.093 20329-20350/? E/Filament: 104:   highp vec3 _979 = vec3(_1145 * (-_1061), _1061) - _748;
08-22 17:46:49.093 20329-20350/? E/Filament: 105:   float _982 = dot(_979, _979);
08-22 17:46:49.093 20329-20350/? E/Filament: 106:   _1150 += ((clamp(1.0 - (_982 * materialParams.invRadiusSquared), 0.0, 1.0) * max(0.0, dot(_979, normalize(cross(vec3(_1122 * (-_807), _807) - _748, vec3(_1132 * (-_862), _862) - _748))) - materialParams.bias)) / (_982 + 0.014999999664723873138427734375));
08-22 17:46:49.093 20329-20350/? E/Filament: 107:   _1149++;
08-22 17:46:49.093 20329-20350/? E/Filament: 108:   continue;
08-22 17:46:49.093 20329-20350/? E/Filament: 109:   }
08-22 17:46:49.093 20329-20350/? E/Filament: 110:   float _687 = 1.0 - (_1150 * 0.14285714924335479736328125);
08-22 17:46:49.093 20329-20350/? E/Filament: 111:   MaterialInputs _1147 = _1100;
08-22 17:46:49.093 20329-20350/? E/Filament: 112:   _1147.baseColor.x = mix(_687, _687 * _687, materialParams.power);
08-22 17:46:49.093 20329-20350/? E/Filament: 113:   fragColor = _1147.baseColor;
08-22 17:46:49.093 20329-20350/? E/Filament: 114:   }

We debugged it and the shader seems to be the generated shader by sao.mat.

Smartphone (please complete the following information):

  • Device: VIVO Y71, VIVO Y51A
  • OS: Android 5.0.2

kaelsass avatar Aug 23 '19 02:08 kaelsass

This looks clearly like a shader compiler bug. We can try to find a workaround but it seems unlikely.

romainguy avatar Sep 05 '19 00:09 romainguy

We can't reproduce at this time but we've changed the code that was causing the crash since then. Hopefully it fixes the problem.

romainguy avatar Apr 09 '20 16:04 romainguy