A compilation error occurred in glCompileShader()

A compilation error occurred when I compiled the fragment-shader source code which was shown below in glCompileShader().
The error message provided by glGetShaderInfoLog() was only ‘Compile failed.’.
By the driver of some other GPU, this source code was compiled without a problem, and the program worked normally.


* Execution Environment
  Model name: Galaxy S
  Model number: SC-02B
  Firmware version: 2.2
  Baseband version: SC02BOMJJ1
  Kernel version: 2.6.32.9
  Build number: FROYO.OMJJ1

* OpenGL Context
  GL_VERSION: OpenGL ES 2.0
  GL_VENDOR: Imagination Technologies
  GL_RENDERER: PowerVR SGX 540

* Android LogCat Message
  loaded /system/lib/egl/libEGL_POWERVR_SGX540_120.so
  loaded /system/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so
  loaded /system/lib/egl/libGLESv2_POWERVR_SGX540_120.so


//


FRAGMENT SHADER SOURCE CODE


#pragma optimize( on )
#if defined( GL_FRAGMENT_PRECISION_HIGH )
precision highp   float;
#else
precision mediump float;
#endif
precision mediump int;
vec4 lrp_QCj4hDAd( vec4 src0, vec4 src1, vec4 src2 ) {
   return src0 * (src1 - src2) + src2;
}

vec4 nrm_QCj4hDAd( vec4 src ) {
   return src * inversesqrt( dot( src.xyz, src.xyz ) );
}

vec4 cmp_QCj4hDAd( vec4 src0, vec4 src1, vec4 src2 ) {
   return vec4( src0.x >= 0.0 ? src1.x : src2.x,
                src0.y >= 0.0 ? src1.y : src2.y,
                src0.z >= 0.0 ? src1.z : src2.z,
                src0.w >= 0.0 ? src1.w : src2.w );
}

uniform vec3 rmu_ambient_lit_col;
uniform vec3 rmu_color_specular;
uniform vec3 rmu_dir_lit_0_col;
uniform vec3 rmu_dir_lit_0_pos;
uniform vec3 rmu_dir_lit_1_col;
uniform vec3 rmu_dir_lit_1_pos;
uniform vec3 rmu_dir_lit_2_col;
uniform vec3 rmu_dir_lit_2_pos;
uniform vec4 rmu_fog_color;
uniform float rmu_fog_p1;
uniform vec2 rmu_fog_range;
uniform float rmu_map_amt_reflection;
uniform mat3 rmu_mat33_mapcoord_1;
uniform float rmu_mtl_compo_phexp;
uniform sampler2D rmu_tex2d_map_0;
uniform sampler2D rmu_tex2d_map_1;
uniform samplerCube rmu_texcube_map_2;
varying vec2 rmv_vec2_mapcoord_0;
varying vec3 rmv_view_N;
varying vec3 rmv_view_P;

void main() {
vec4 r0_QCj4hDAd;
vec4 r1_QCj4hDAd;
vec4 r2_QCj4hDAd;
vec4 r3_QCj4hDAd;
vec4 r4_QCj4hDAd;
vec4 r5_QCj4hDAd;
vec4 c19_QCj4hDAd = vec4( 1, 0, 0, 0 );

r0_QCj4hDAd.x = (vec4( dot( rmv_view_P, rmv_view_P ) )).x;
r0_QCj4hDAd.x = (vec4( inversesqrt( r0_QCj4hDAd.x ) )).x;
r1_QCj4hDAd.xyz = (vec4( rmv_view_P, rmv_view_P.z )).xyz;
r0_QCj4hDAd.yzw = (r1_QCj4hDAd.xxyz * -r0_QCj4hDAd.xxxx + vec4( rmu_dir_lit_1_pos.xxy, rmu_dir_lit_1_pos.z )).yzw;
r2_QCj4hDAd.xyz = (nrm_QCj4hDAd( r0_QCj4hDAd.yzww )).xyz;
r3_QCj4hDAd.xyz = (nrm_QCj4hDAd( vec4( rmv_view_N, rmv_view_N.z ) )).xyz;
r0_QCj4hDAd.y = (vec4( dot( r3_QCj4hDAd.xyz, r2_QCj4hDAd.xyz ) )).y;
r1_QCj4hDAd.w = (vec4( pow( abs( r0_QCj4hDAd.y ), rmu_mtl_compo_phexp ) )).w;
r0_QCj4hDAd.y = (cmp_QCj4hDAd( -r0_QCj4hDAd.yyyy, c19_QCj4hDAd.yyyy, r1_QCj4hDAd.wwww )).y;
r0_QCj4hDAd.yzw = (r0_QCj4hDAd.yyyy * vec4( rmu_dir_lit_1_col.xxy, rmu_dir_lit_1_col.z )).yzw;
r2_QCj4hDAd.xyz = (r1_QCj4hDAd * -r0_QCj4hDAd.xxxx + vec4( rmu_dir_lit_0_pos, rmu_dir_lit_0_pos.z )).xyz;
r4_QCj4hDAd.xyz = (nrm_QCj4hDAd( r2_QCj4hDAd )).xyz;
r1_QCj4hDAd.w = (vec4( dot( r3_QCj4hDAd.xyz, r4_QCj4hDAd.xyz ) )).w;
r2_QCj4hDAd.x = (vec4( pow( abs( r1_QCj4hDAd.w ), rmu_mtl_compo_phexp ) )).x;
r1_QCj4hDAd.w = (cmp_QCj4hDAd( -r1_QCj4hDAd.wwww, c19_QCj4hDAd.yyyy, r2_QCj4hDAd.xxxx )).w;
r0_QCj4hDAd.yzw = (vec4( rmu_dir_lit_0_col.xxy, rmu_dir_lit_0_col.z ) * r1_QCj4hDAd.wwww + r0_QCj4hDAd).yzw;
r1_QCj4hDAd.xyw = (r1_QCj4hDAd.xyzz * -r0_QCj4hDAd.xxxx + vec4( rmu_dir_lit_2_pos, rmu_dir_lit_2_pos.z )).xyw;
r2_QCj4hDAd.xyz = (r0_QCj4hDAd.xxxx * vec4( rmv_view_P, rmv_view_P.z )).xyz;
r4_QCj4hDAd.xyz = (nrm_QCj4hDAd( r1_QCj4hDAd.xyww )).xyz;
r0_QCj4hDAd.x = (vec4( dot( r3_QCj4hDAd.xyz, r4_QCj4hDAd.xyz ) )).x;
r1_QCj4hDAd.x = (vec4( pow( abs( r0_QCj4hDAd.x ), rmu_mtl_compo_phexp ) )).x;
r0_QCj4hDAd.x = (cmp_QCj4hDAd( -r0_QCj4hDAd.xxxx, c19_QCj4hDAd.yyyy, r1_QCj4hDAd.xxxx )).x;
r0_QCj4hDAd.xyz = (vec4( rmu_dir_lit_2_col, rmu_dir_lit_2_col.z ) * r0_QCj4hDAd.xxxx + r0_QCj4hDAd.yzww).xyz;
r0_QCj4hDAd.w = (clamp( vec4( dot( r3_QCj4hDAd.xyz, rmu_dir_lit_1_pos ) ), 0.0, 1.0 )).w;
r1_QCj4hDAd.xyw = (r0_QCj4hDAd.wwww * vec4( rmu_dir_lit_1_col, rmu_dir_lit_1_col.z )).xyw;
r0_QCj4hDAd.w = (clamp( vec4( dot( r3_QCj4hDAd.xyz, rmu_dir_lit_0_pos ) ), 0.0, 1.0 )).w;
r1_QCj4hDAd.xyw = (vec4( rmu_dir_lit_0_col, rmu_dir_lit_0_col.z ) * r0_QCj4hDAd.wwww + r1_QCj4hDAd).xyw;
r0_QCj4hDAd.w = (clamp( vec4( dot( r3_QCj4hDAd.xyz, rmu_dir_lit_2_pos ) ), 0.0, 1.0 )).w;
r1_QCj4hDAd.xyw = (vec4( rmu_dir_lit_2_col, rmu_dir_lit_2_col.z ) * r0_QCj4hDAd.wwww + r1_QCj4hDAd).xyw;
r4_QCj4hDAd = texture2D( rmu_tex2d_map_1, rmv_vec2_mapcoord_0 );
r0_QCj4hDAd.w = (-r4_QCj4hDAd.xxxx + c19_QCj4hDAd.xxxx).w;
r5_QCj4hDAd = texture2D( rmu_tex2d_map_0, rmv_vec2_mapcoord_0 );
r4_QCj4hDAd.yzw = (r0_QCj4hDAd.wwww * r5_QCj4hDAd.xxyz).yzw;
r1_QCj4hDAd.xyw = (r1_QCj4hDAd * r4_QCj4hDAd.yzzw).xyw;
r1_QCj4hDAd.xyw = (r4_QCj4hDAd.yzzw * vec4( rmu_ambient_lit_col, rmu_ambient_lit_col.z ) + r1_QCj4hDAd).xyw;
r1_QCj4hDAd.xyw = (r4_QCj4hDAd.xxxx * r5_QCj4hDAd.xyzz + r1_QCj4hDAd).xyw;
r0_QCj4hDAd.xyz = (vec4( rmu_color_specular, rmu_color_specular.z ) * r0_QCj4hDAd + r1_QCj4hDAd.xyww).xyz;
r0_QCj4hDAd.w = (vec4( dot( r2_QCj4hDAd.xyz, r3_QCj4hDAd.xyz ) )).w;
r0_QCj4hDAd.w = (r0_QCj4hDAd.wwww + r0_QCj4hDAd.wwww).w;
r1_QCj4hDAd.xyw = (r3_QCj4hDAd.xyzz * -r0_QCj4hDAd.wwww + r2_QCj4hDAd.xyzz).xyw;
r2_QCj4hDAd.xyz = (r1_QCj4hDAd.yyyy * vec4( rmu_mat33_mapcoord_1[1], rmu_mat33_mapcoord_1[1].z )).xyz;
r2_QCj4hDAd.xyz = (vec4( rmu_mat33_mapcoord_1[0], rmu_mat33_mapcoord_1[0].z ) * r1_QCj4hDAd.xxxx + r2_QCj4hDAd).xyz;
r1_QCj4hDAd.xyw = (vec4( rmu_mat33_mapcoord_1[2], rmu_mat33_mapcoord_1[2].z ) * r1_QCj4hDAd.wwww + r2_QCj4hDAd.xyzz).xyw;
r2_QCj4hDAd = textureCube( rmu_texcube_map_2, r1_QCj4hDAd.xyw );
r0_QCj4hDAd.xyz = (r2_QCj4hDAd * vec4( rmu_map_amt_reflection ) + r0_QCj4hDAd).xyz;
r1_QCj4hDAd.x = (clamp( vec4( rmu_fog_range.y ) * -r1_QCj4hDAd.zzzz + vec4( rmu_fog_range.x ), 0.0, 1.0 )).x;
r1_QCj4hDAd.x = (r1_QCj4hDAd.xxxx * vec4( rmu_fog_p1 )).x;
r1_QCj4hDAd.x = (vec4( exp2( r1_QCj4hDAd.x ) )).x;
r1_QCj4hDAd.x = (-r1_QCj4hDAd.xxxx + c19_QCj4hDAd.xxxx).x;
r0_QCj4hDAd.w = (c19_QCj4hDAd.xxxx).w;
gl_FragColor = lrp_QCj4hDAd( r1_QCj4hDAd.xxxx, rmu_fog_color, r0_QCj4hDAd );
}

A compilation error occurred in the following source code in the same way.

//
FRAGMENT SHADER SOURCE CODE

precision highp float;

uniform sampler2D Tx;
varying vec3 Pt;

void main() {
vec3 v01 = Pt.x * Pt;
vec3 v02 = 2.0 * v01;
float f03 = dot(v01, vec3(1));
float f05 = (f03 < 0.0) ? 0.0 : -f03;
vec3 v06 = 2.0 * Pt;
float f07 = dot(v06, v01);
float f08 = f07 + f05;
float f09 = dot(v02, v02);
float f10 = f08 + f09;
vec3 v11 = f10 * v01;
vec4 v12 = texture2D(Tx, Pt.xy);
vec3 v13 = v11 + v06;
vec3 v14 = v12.xyz + v13;
gl_FragColor = vec4(v14, -Pt.x);
}


The following link has the source code of test application.

http://dl.dropbox.com/u/23346852/ticket-531/Test531-source.zip

The following file is built application package.

http://dl.dropbox.com/u/23346852/ticket-531/Test531.apk

The following image is expected rendering result.



The following image is rendering result in Galaxy S (PowerVR SGX 540).



It is information of Galaxy S which executed application as follows.

  Model number: SC-02B
  Firmware version: 2.2.1
  Baseband version: SC02BOMKA5
  Kernel version: 2.6.32.9
  Build number: FROYO.OMKA5




The problem was improved when I updated the version of the Android from 2.2 to 2.3.Clap

Hi,





When you say the problem was improved (as you also did with another topic), do you mean the issue has gone away completely, or you are now having other issues?

Hi,

I’m sorry for my poor English.

It was the meaning that the issue was completely solved.
It was a meaning same about another topic.


Ah, ok. No problem. Glad to hear they’re resolved now :slight_smile: