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

Tracking down a crash while linking a shader

Hello, Im trying to find track down a crash in our Android App. It happens inside a call to glLinkProgram. It seems to only happen when compiling a shader with multi-render targets of a certain complexity. I've no idea what might be causing this or how to progress with it. The fragment and vertex shaders compile without errors but then the link crashes. It crashes 100% of the time on at least these devices:  

Samsung Galaxy S6 (Android 7.0)

Samsung Galaxy S6 Edge (6.0.1)

Huawei P9 (6.0)

07-26 07:45:18.225 18933 18989 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 18989 (Render Thread)
07-26 07:45:18.225 18549 18647 W SearchServiceCore: Abort, client detached.
07-26 07:45:18.235 3419 4399 V BroadcastQueue: [background] Process cur broadcast BroadcastRecord{81b168f u0 com.google.android.gms.gcm.ACTION_SCHEDULE qIdx=4}, state= (APP_RECEIVE) DELIVERED for app ProcessRecord{532058e 20629:com.google.android.gms.persistent/u0a17}
07-26 07:45:18.235 3419 4399 V BroadcastQueue: [background] Process cur broadcast BroadcastRecord{6025d1c u0 com.google.android.apps.gsa.broadcastreceiver.ACTION_OPA_ELIGIBILITY_CHANGE qIdx=4}, state= (APP_RECEIVE) DELIVERED for app ProcessRecord{1369ec7 18549:com.google.android.googlequicksearchbox:search/u0a68}
07-26 07:45:18.245 3419 3469 V AlarmManager: remove PendingIntent] PendingIntent{7085d25: PendingIntentRecord{d0a3b0f com.google.android.gms broadcastIntent}}
07-26 07:45:18.275 3037 3037 W SELinux : Function: selinux_compare_spd_ram, index[3], priority [2], priority version is VE=SEPF_SECMOBILE_6.0.1_0004
07-26 07:45:18.325 3037 3037 W SELinux : SELinux: Loaded file_contexts contexts from /file_contexts.
07-26 07:45:18.325 3037 3037 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-26 07:45:18.325 3037 3037 F DEBUG : Build fingerprint: 'samsung/zeroltexx/zerolte:6.0.1/MMB29K/G925FXXU3DPC2:user/release-keys'
07-26 07:45:18.325 3037 3037 F DEBUG : Revision: '10'
07-26 07:45:18.325 3037 3037 F DEBUG : ABI: 'arm64'
07-26 07:45:18.325 3037 3037 F DEBUG : pid: 18933, tid: 18989, name: Render Thread >>> playsectiontestbed.pregnancy.hp.playsectiontestbed <<<
07-26 07:45:18.325 3037 3037 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
07-26 07:45:18.345 3037 3037 F DEBUG : x0 0000000000000001 x1 0000007f9b527888 x2 0000000000000000 x3 0000007f9b527888
07-26 07:45:18.345 3037 3037 F DEBUG : x4 51d4666a69df4a01 x5 0000007f7ac4fc40 x6 0000007f7ac3e1d8 x7 0000007f7ac50040
07-26 07:45:18.345 3037 3037 F DEBUG : x8 00000000ffffffff x9 0000000000000001 x10 0000000000000000 x11 0000000000000000
07-26 07:45:18.345 3037 3037 F DEBUG : x12 000000000000000b x13 0000000000000001 x14 0000000000000001 x15 0000007f80772d70
07-26 07:45:18.345 3037 3037 F DEBUG : x16 0000000000000000 x17 51d4666a69df4a01 x18 00000000ffffffff x19 0000007f80d5e000
07-26 07:45:18.345 3037 3037 F DEBUG : x20 0000000000000000 x21 0000007f7ac4d888 x22 0000007f7ac509b8 x23 0000000000000000
07-26 07:45:18.345 3037 3037 F DEBUG : x24 0000000000000000 x25 0000007f7ac4d8e0 x26 0000000000000020 x27 0000007f90eeea28
07-26 07:45:18.345 3037 3037 F DEBUG : x28 0000000088ca6c00 x29 0000007f7ecfa5e0 x30 0000007f7f99a690
07-26 07:45:18.345 3037 3037 F DEBUG : sp 0000007f7ecfa020 pc 0000007f7f996a18 pstate 0000000060000000
07-26 07:45:18.355 3037 3037 F DEBUG :
07-26 07:45:18.355 3037 3037 F DEBUG : backtrace:
07-26 07:45:18.355 3037 3037 F DEBUG : #00 pc 0000000000568a18 /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #01 pc 000000000056c68c /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #02 pc 000000000056d178 /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #03 pc 000000000053d7bc /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #04 pc 000000000053d9b0 /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #05 pc 000000000053e724 /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #06 pc 000000000057c740 /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #07 pc 000000000045047c /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #08 pc 00000000005c1fd0 /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #09 pc 0000000000620a68 /system/vendor/lib64/egl/libGLES_mali.so
07-26 07:45:18.355 3037 3037 F DEBUG : #10 pc 000000000061a188 /system/vendor/lib64/egl/libGLES_mali.so

The Fragment shader is as follows: setting KERNEL_SIZE to 3 works ok but 4 crashes:

#version 300 es

#define KERNEL_SIZE 4

uniform sampler2D uniformTexture;
uniform sampler2D uniformWeightMaskTexture;
uniform highp vec2 uniformTexelSize;

uniform highp float uniformKernelWidth;
uniform int uniformKernelRange;
uniform highp vec4 uniformKernelWeights[16];

in highp vec2 varyingTextureCoord;

layout(location = 0) out highp vec4 outColour;
layout(location = 1) out highp vec4 outMaskWeight;

void main(void)
{
  mediump float weight0=uniformKernelWeights[0].r;

  mediump vec4 col=texture(uniformTexture, varyingTextureCoord)*weight0;
  mediump float maskWeight=texture(uniformWeightMaskTexture, varyingTextureCoord).r*weight0;

  for (int i=1;i<KERNEL_SIZE;I++)
  {
      mediump vec4 kernelWeight=uniformKernelWeights[i];
      mediump float ofs=kernelWeight.b;

      highp vec2 uv0=varyingTextureCoord+vec2(ofs,0);
      highp vec2 uv1=varyingTextureCoord+vec2(-ofs,0);

      col+=texture(uniformTexture, uv0)*kernelWeight.r;
      col+=texture(uniformTexture, uv1)*kernelWeight.r;

      maskWeight+=texture(uniformWeightMaskTexture, uv0).r*kernelWeight.r;
      maskWeight+=texture(uniformWeightMaskTexture, uv1).r*kernelWeight.r;
    }

    outColour = col;
    outMaskWeight=vec4(maskWeight,0,0,1);
}

Thank you.

Martin.