Forums - glLinkProgram crash because of arrays in vertex shader

2 posts / 0 new
Last post
glLinkProgram crash because of arrays in vertex shader
pontomedon
Join Date: 26 Jul 13
Posts: 5
Posted: Wed, 2013-07-31 04:57

I have a shader that is giving me a hard time on Adreno GPUs, while working fine on others (tried on Mali-400 MP and PowerVR SGX 540). I have access to three Adreno devices:

1. Samsung Galaxy S (GT-I9000), Android 2.3.3, GL_RENDERER: Adreno (TM) 220, GL_VERSION: OpenGL ES 2.0 1566933
2. Samsung Galaxy Tab 8.9 AT&T (SGH-I957), Android 3.1, GL_RENDERER: Adreno (TM) 220, OpenGL ES 2.0 1566933
3. LG Nexus 4, Android 4.2.2, GL_RENDERER: Adreno (TM) 320, OpenGL ES 2.0 [email protected] AU@ (CL@2961380)

on 1), the shader compiles and links, but draws garbage (I didn't investigate that any further)

on 2), the shader compiles but doesn't link. The error message contains nothing but

Quote:

--From Fragment Shader:
--From Vertex Shader:

on 3), the glLinkProgram call crashes: (see crashdump.txt)

I discovered that indexing of arrays is causing the problem, but only under certain circumstances that i wasn't able to understand so far.

I am willing to privately send the shader that causes the problem.

  • Up0
  • Down0
pontomedon
Join Date: 26 Jul 13
Posts: 5
Posted: Sun, 2013-08-04 23:33

I managed to fix the crash on the Nexus 4 by (very strictly) following the GLSL ES spec, Appendix A.

In detail, i re-wrote the shader to only use for loops with constant bounds and increments, and access arrays only with constant expressions or expressions composed of loop indices and constant expressions.

In Addition to that, i discovered that the shader linker doesn't like expressions where you index arrays on both the left and the right side: "lines[i] = points[i+1]-points[i];" crashes, but "vec2 start = points[i]; vec2 end = points[i+1]; vec2 line = end-start; lines[i] = line;" doesn't.

I really think that the driver should emit a compiler error when language features are used that are not enforced by the spec and not supported by the compiler. Or, if it must be in the Linker, it should emit an error there, and not just crash, which took me almost a week of work to fix. With a proper log saying that i cannot use dynamic array indices, it would have been a matter of a few hours at most.

Oh and by the way, the issues on the Galaxy S and the Samsung tablet still persist....

  • 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.