Forums - Crash in glLinkProgram on Adreno 320 (Nexus 4)

3 posts / 0 new
Last post
Crash in glLinkProgram on Adreno 320 (Nexus 4)
justin.webb
Join Date: 22 Jan 13
Location: Oxford, England
Posts: 1
Posted: Thu, 2013-01-31 03:58

Hi,

I've seen a few topics on this forum discussing the potential for glLinkProgram crashes when performing texture sample lookup within a (non-main) function. Most of these topics have been left with yourselves requesting sample code, and seemingly not receiving it. I'm not sure whether the following issue is connected, but I'm highlighting the possibility in the hope that it may aid debugging:

What I'm essentially seeing is a reliable crash when attempting to link the following shader combination on the Adreno 320 (Nexus 4). Please note that this is the only Adreno device I have access to, so am not sure if it's a driver issue with this model or something more pervasive. The following shader source has been run through 'GLSL Optimiser' and consequently obfuscated:

-------------------------------------------
-------- Vertex Shader ---------------
-------------------------------------------

attribute vec2 VSTexCoord0;
attribute vec3 VSPosition;
varying vec2 PSUV0;
void main ()
{
gl_Position.xy = VSPosition.xy;
gl_Position.z = 0.000000;
gl_Position.w = 1.00000;
PSUV0 = VSTexCoord0;
}

-------------------------------------------
--------- Pixel Shader -----------------
-------------------------------------------

Note: Edited shader to include 'lowp' precision following testing on Nexus 7.

uniform lowp vec4 g_userData;
uniform sampler2D texSource2;
uniform sampler2D texSource1;
varying vec2 PSUV0;
void main ()
{
lowp vec2 uv2_1;
lowp vec2 uv1_2;
lowp vec3 uvw_3;
lowp vec3 tmpvar_4;
tmpvar_4 = ((((g_userData.x - 1.00000) * g_userData.y) * texture2D (texSource1, PSUV0).xzy) + (0.500000 * g_userData.y));
uvw_3.yz = tmpvar_4.yz;
uvw_3.x = (tmpvar_4.x * g_userData.y);
lowp float tmpvar_5;
tmpvar_5 = ((tmpvar_4.z * g_userData.x) - 0.500000);
lowp float tmpvar_6;
tmpvar_6 = floor(tmpvar_5);
lowp float tmpvar_7;
tmpvar_7 = clamp ((tmpvar_6 + 1.00000), 0.000000, (g_userData.x - 1.00000));
uv1_2.y = uvw_3.y;
uv2_1.y = uvw_3.y;
uv1_2.x = (uvw_3.x + (clamp (tmpvar_6, 0.000000, (g_userData.x - 1.00000)) * g_userData.y));
uv2_1.x = (uvw_3.x + (tmpvar_7 * g_userData.y));
gl_FragColor = mix (texture2D (texSource2, uv1_2), texture2D (texSource2, uv2_1), (1.00000 - (tmpvar_7 - tmpvar_5)));
}

-------------------------------------------
------ Crash Log (cribbed) ----------
-------------------------------------------

Fatal signal 11 (SIGSEGV) at 0x00000004 (code=1), thread 6318 (Thread-1702)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/occam/mako:4.2.1/JOP40D/533553:user/release-keys'
pid: 6304, tid: 6318, name: Thread-1702 >>> com.example.android.basicglsurfaceview <<<
Revision: '11'
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000004
r0 00000000 r1 00000018 r2 7320e438 r3 0000000c
r4 7320e468 r5 00000018 r6 00000002 r7 00000000
r8 00000000 r9 73643ac8 sl 00000000 fp 71f950c4
ip 00000002 sp 741a28a0 lr 7488d3ff pc 7488d27c cpsr 00000030

...

#14 pc 000973cb /system/lib/libsc-a3xx.so (__link_shaders+326)
#15 pc 000296c7 /system/lib/egl/libGLESv2_adreno200.so (glLinkProgram+610)

-------------------------------------------
---------- Device & Build -------------
-------------------------------------------

Brand: Google
Model: Nexus 4
Version: 4.2.1 (API 17) Rev 53353

EGL
- Vendor : Android
- Version : 1.4 Android META-EGL
- QUALCOMM build: Nondeterministic AU_full_mako_PARTNER-ANDROID/JB-MR1-DEV_CL2946718_release_AU (CL2946718)
- QUALCOMM build: Build Date: 11/04/12 Sun
- QUALCOMM build: Local Branch:
- QUALCOMM build: Remote Branch: m/partner-android/jb-mr1-dev
- QUALCOMM build: Local Patches: NONE
- QUALCOMM build: Reconstruct Branch: NOTHING

OpenGL
- Vendor : Qualcomm
- Renderer : Adreno (TM) 320
- Version : OpenGL ES 2.0 [email protected] AU@ (CL@2946718)
- Shader Lang : OpenGL ES GLSL ES 1.00

I have also produced a very small reproducible application (using 'Basic GLSurfaceView' as a template) but can't upload this fully as your attachment system is restricted to just '.txt' files. I have attached the 'GLES20TriangleRender.java' (as .txt) which you can substitute with a copy of the standard Android SDK sample. There is also a version of the (uncribbed) crash log/backtrace and shaders. If you need any additional information or resources, please let me know.

Have you had any previous experience with device issues such as this? Are you aware of any workarounds or potential fixes?

Thanks and Kind Regards,

Justin Webb
NaturalMotion Games Ltd

  • Up0
  • Down0
sanchiski
Join Date: 29 Jan 13
Posts: 4
Posted: Tue, 2013-08-27 07:30

I am facing the exact same problem. A Fatal signal 11 (SIGSEGV) right when calling glLinkProgram on Adreon 320 in a Nexus 4.

To make things even more strange, my shader is really simple.

Is there a solution for this yet?

Thanks

  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Mon, 2013-10-07 07:42

Can you share your shader code with us?  Although there are some compiler bugs that we are addressing, Justin was able to work around the crash by caching some of the results:

 

  vec2 uv2_1;

  vec2 uv1_2;

  vec3 uvw_3;

  float tmpvar_4;

  tmpvar_4 = ((((g_userData.x - 1.00000) * g_userData.y) * texture2D (texSource1, PSUV0).xzy) + (0.500000 * g_userData.y));

  tmpvar_4 = (g_userData.x - 1.00000); (now caching for a slight optimisation)

  vec3 tmpvar_5;

  tmpvar_5 = ((texture2D (texSource1, PSUV0).xzy * vec3((tmpvar_4 * g_userData.y))) + vec3((0.500000 * g_userData.y)));

  uvw_3.yz = tmpvar_5.yz;

  uvw_3.x = (tmpvar_5.x * g_userData.y);

  float tmpvar_6;

  tmpvar_6 = ((tmpvar_5.z * g_userData.x) - 0.500000);

  float tmpvar_7;

  tmpvar_7 = floor(tmpvar_6);

  float tmpvar_8;

  tmpvar_8 = clamp ((tmpvar_7 + 1.00000), 0.000000, tmpvar_4);

  uv1_2.y = uvw_3.y;

  uv2_1.y = uvw_3.y;

  uv1_2.x = (uvw_3.x + (clamp (tmpvar_7, 0.000000, tmpvar_4) * g_userData.y));

  uv2_1.x = (uvw_3.x + (tmpvar_8 * g_userData.y));

  gl_FragColor = mix (texture2D (texSource2, uv1_2), texture2D (texSource2, uv2_1), (1.00000 - (tmpvar_8 - tmpvar_6)));

 

 

-mark

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.