Adreno 320 GPU GLSL shader issues on Android

It seems that they didn’t spend much time in coding the graphic card drivers for Andreno 320 GPU. In my latest project I encountered a crash on linking some GLSL shader programs. It really took a while to figure out the cause. After a while could break down the shader code to something that looks like:

struct _Diffuse_Type
{
  lowp vec4 Color;
  sampler2D Texture;
};

uniform _Diffuse_Type Diffuse;

varying vec4 v_vtxColor;
varying vec2 v_texcoord0;
#ifdef VERTEX

uniform mat4 u_modelViewProjection;
attribute vec4 a_position;
attribute vec4 a_vtxColor;
attribute vec2 a_texcoord0;

void main()
{
  gl_Position = u_modelViewProjection * a_position;
  v_vtxColor = Diffuse.Color * a_vtxColor;
  v_texcord0 = a_texcoord;
}
#endif

#ifdef PIXEL
void main()
{
  gl_FragColor = texture2D( Diffuse.Texture, v_texcoord0 ) * v_vtxColor;
}
#endif

It came out that Andreno 320 GPU seems to have an issue with Textures in structs. At least if using that struct inside the vertex shader. At the end the solution really was that easy. I wrote a script that did all the work of rewriting the material entries.

But one question still rumors in my head: Was there any one on this planet who liked game development on Android?

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.