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

64 lines
1.3 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
)
{
mediump vec3 light_2;
lowp vec4 col_3;
int j_4;
int tmpvar_5;
tmpvar_5 = 0;
j_4 = tmpvar_5;
lowp vec4 tmpvar_6;
tmpvar_6 = texture2D (_MainTex, i_1.uv);
lowp vec4 tmpvar_7;
tmpvar_7 = tmpvar_6;
col_3 = tmpvar_7;
if ((col_3.w < 0.5)) {
discard;
};
vec3 tmpvar_8;
tmpvar_8 = vec3(0.0, 0.0, 0.0);
light_2 = tmpvar_8;
while (true) {
if (!((j_4 < 3))) {
break;
};
highp vec3 tmpvar_9;
tmpvar_9 = (light_2 + ((col_3.xyz * i_1.nl[j_4]) * _TerrainTreeLightColors[j_4].xyz));
light_2 = tmpvar_9;
int _post_incdec_tmp_10;
_post_incdec_tmp_10 = j_4;
int tmpvar_11;
tmpvar_11 = (j_4 + 1);
j_4 = tmpvar_11;
};
mediump vec4 tmpvar_12;
tmpvar_12.w = 1.0;
tmpvar_12.xyz = light_2.xyz;
return tmpvar_12;
}
void main ()
{
v2f i_13;
highp vec2 tmpvar_14;
tmpvar_14 = xlv_uv;
i_13.uv = tmpvar_14;
highp vec3 tmpvar_15;
tmpvar_15 = xlv_nl;
i_13.nl = tmpvar_15;
lowp vec4 tmpvar_16;
tmpvar_16 = xlat_main (i_13);
lowp vec4 tmpvar_17;
tmpvar_17 = tmpvar_16;
gl_FragData[0] = tmpvar_17;
}