bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-forafterdiscard-irES.txt
2012-10-07 20:41:18 -07:00

62 lines
1.2 KiB
Text

struct v2f {
highp vec2 uv;
highp vec3 nl;
};
varying highp vec3 xlv_nl;
varying highp vec2 xlv_uv;
uniform highp vec4 _TerrainTreeLightColors[4];
uniform sampler2D _MainTex;
lowp vec4 xlat_main (
in v2f i_1
)
{
int j_2;
mediump vec3 light_3;
lowp vec4 col_4;
lowp vec4 tmpvar_5;
tmpvar_5 = texture2D (_MainTex, i_1.uv);
lowp vec4 tmpvar_6;
tmpvar_6 = tmpvar_5;
col_4 = tmpvar_6;
if ((col_4.w < 0.5)) {
discard;
};
vec3 tmpvar_7;
tmpvar_7 = vec3(0.0, 0.0, 0.0);
light_3 = tmpvar_7;
int tmpvar_8;
tmpvar_8 = 0;
j_2 = tmpvar_8;
while (true) {
if (!((j_2 < 3))) {
break;
};
highp vec3 tmpvar_9;
tmpvar_9 = (light_3 + ((col_4.xyz * i_1.nl[j_2]) * _TerrainTreeLightColors[j_2].xyz));
light_3 = tmpvar_9;
int tmpvar_10;
tmpvar_10 = (j_2 + 1);
j_2 = tmpvar_10;
};
mediump vec4 tmpvar_11;
tmpvar_11.w = 1.0;
tmpvar_11.xyz = light_3.xyz;
return tmpvar_11;
}
void main ()
{
v2f i_12;
highp vec2 tmpvar_13;
tmpvar_13 = xlv_uv;
i_12.uv = tmpvar_13;
highp vec3 tmpvar_14;
tmpvar_14 = xlv_nl;
i_12.nl = tmpvar_14;
lowp vec4 tmpvar_15;
tmpvar_15 = xlat_main (i_12);
lowp vec4 tmpvar_16;
tmpvar_16 = tmpvar_15;
gl_FragData[0] = tmpvar_16;
}