bgfx/3rdparty/glsl-optimizer/tests/fragment/loop-forafterdiscard-inES3.txt

27 lines
608 B
Text
Raw Normal View History

2014-10-11 15:32:43 -04:00
#version 300 es
out lowp vec4 _fragData;
struct v2f {
highp vec2 uv;
mediump vec3 nl;
};
uniform sampler2D _MainTex;
uniform mediump vec4 _TerrainTreeLightColors[4];
lowp vec4 xlat_main (in v2f i) {
2015-04-03 02:30:48 -04:00
lowp vec4 col = texture( _MainTex, i.uv);
2014-10-11 15:32:43 -04:00
if (col.w < 0.5)
discard;
mediump vec3 light = vec3(0.0);
for (int j = 0; j < 3; ++j) {
light += col.xyz * i.nl[j] * _TerrainTreeLightColors[j].xyz;
}
return vec4(light, 1.0);
}
in highp vec2 xlv_uv;
in mediump vec3 xlv_nl;
void main() {
v2f i;
i.uv = xlv_uv;
i.nl = xlv_nl;
_fragData = xlat_main(i);
}