bgfx/3rdparty/glsl-optimizer/tests/vertex/MF-GodRays-irES.txt
2014-02-10 23:06:13 -08:00

555 lines
13 KiB
Text

struct v2f {
highp vec4 pos;
highp vec2 uv;
lowp vec4 color;
};
struct appdata_full {
highp vec4 vertex;
highp vec4 tangent;
highp vec3 normal;
highp vec4 texcoord;
highp vec4 texcoord1;
highp vec4 color;
};
attribute highp vec4 _glesVertex;
attribute mediump vec3 _glesNormal;
attribute highp vec4 _glesMultiTexCoord0;
attribute highp vec4 _glesMultiTexCoord1;
attribute lowp vec4 _glesColor;
uniform highp float _Bias;
uniform highp float _BlinkingTimeOffsScale;
uniform highp vec4 _Color;
uniform highp float _FadeOutDistFar;
uniform highp float _FadeOutDistNear;
uniform highp float _MaxGrowSize;
uniform highp float _Multiplier;
uniform highp float _NoiseAmount;
uniform highp float _SizeGrowEndDist;
uniform highp float _SizeGrowStartDist;
uniform highp vec4 _Time;
uniform highp float _TimeOffDuration;
uniform highp float _TimeOnDuration;
uniform highp float _VerticalBillboarding;
uniform highp mat4 _World2Object;
uniform highp vec3 _WorldSpaceCameraPos;
uniform highp mat4 glstate_matrix_mvp;
attribute vec4 TANGENT;
varying highp vec4 xlv_SV_POSITION;
varying highp vec2 xlv_TEXCOORD0;
varying lowp vec4 xlv_TEXCOORD1;
float xll_mod (
in float x_1,
in float y_2
)
{
float f_3;
float d_4;
float tmpvar_5;
tmpvar_5 = (x_1 / y_2);
d_4 = tmpvar_5;
float tmpvar_6;
tmpvar_6 = abs (d_4);
float tmpvar_7;
tmpvar_7 = fract (tmpvar_6);
float tmpvar_8;
tmpvar_8 = (tmpvar_7 * y_2);
f_3 = tmpvar_8;
float tmpvar_9;
if ((d_4 >= 0.0)) {
tmpvar_9 = f_3;
} else {
tmpvar_9 = -(f_3);
};
return tmpvar_9;
}
vec2 xll_mod (
in vec2 x_10,
in vec2 y_11
)
{
vec2 f_12;
vec2 d_13;
vec2 tmpvar_14;
tmpvar_14 = (x_10 / y_11);
d_13 = tmpvar_14;
vec2 tmpvar_15;
tmpvar_15 = abs (d_13);
vec2 tmpvar_16;
tmpvar_16 = fract (tmpvar_15);
vec2 tmpvar_17;
tmpvar_17 = (tmpvar_16 * y_11);
f_12 = tmpvar_17;
float tmpvar_18;
if ((d_13.x >= 0.0)) {
tmpvar_18 = f_12.x;
} else {
tmpvar_18 = -(f_12.x);
};
float tmpvar_19;
if ((d_13.y >= 0.0)) {
tmpvar_19 = f_12.y;
} else {
tmpvar_19 = -(f_12.y);
};
vec2 tmpvar_20;
tmpvar_20.x = tmpvar_18;
tmpvar_20.y = tmpvar_19;
return tmpvar_20;
}
vec3 xll_mod (
in vec3 x_21,
in vec3 y_22
)
{
vec3 f_23;
vec3 d_24;
vec3 tmpvar_25;
tmpvar_25 = (x_21 / y_22);
d_24 = tmpvar_25;
vec3 tmpvar_26;
tmpvar_26 = abs (d_24);
vec3 tmpvar_27;
tmpvar_27 = fract (tmpvar_26);
vec3 tmpvar_28;
tmpvar_28 = (tmpvar_27 * y_22);
f_23 = tmpvar_28;
float tmpvar_29;
if ((d_24.x >= 0.0)) {
tmpvar_29 = f_23.x;
} else {
tmpvar_29 = -(f_23.x);
};
float tmpvar_30;
if ((d_24.y >= 0.0)) {
tmpvar_30 = f_23.y;
} else {
tmpvar_30 = -(f_23.y);
};
float tmpvar_31;
if ((d_24.z >= 0.0)) {
tmpvar_31 = f_23.z;
} else {
tmpvar_31 = -(f_23.z);
};
vec3 tmpvar_32;
tmpvar_32.x = tmpvar_29;
tmpvar_32.y = tmpvar_30;
tmpvar_32.z = tmpvar_31;
return tmpvar_32;
}
vec4 xll_mod (
in vec4 x_33,
in vec4 y_34
)
{
vec4 f_35;
vec4 d_36;
vec4 tmpvar_37;
tmpvar_37 = (x_33 / y_34);
d_36 = tmpvar_37;
vec4 tmpvar_38;
tmpvar_38 = abs (d_36);
vec4 tmpvar_39;
tmpvar_39 = fract (tmpvar_38);
vec4 tmpvar_40;
tmpvar_40 = (tmpvar_39 * y_34);
f_35 = tmpvar_40;
float tmpvar_41;
if ((d_36.x >= 0.0)) {
tmpvar_41 = f_35.x;
} else {
tmpvar_41 = -(f_35.x);
};
float tmpvar_42;
if ((d_36.y >= 0.0)) {
tmpvar_42 = f_35.y;
} else {
tmpvar_42 = -(f_35.y);
};
float tmpvar_43;
if ((d_36.z >= 0.0)) {
tmpvar_43 = f_35.z;
} else {
tmpvar_43 = -(f_35.z);
};
float tmpvar_44;
if ((d_36.w >= 0.0)) {
tmpvar_44 = f_35.w;
} else {
tmpvar_44 = -(f_35.w);
};
vec4 tmpvar_45;
tmpvar_45.x = tmpvar_41;
tmpvar_45.y = tmpvar_42;
tmpvar_45.z = tmpvar_43;
tmpvar_45.w = tmpvar_44;
return tmpvar_45;
}
float xll_saturate (
in float x_46
)
{
float tmpvar_47;
tmpvar_47 = clamp (x_46, 0.0, 1.0);
return tmpvar_47;
}
vec2 xll_saturate (
in vec2 x_48
)
{
vec2 tmpvar_49;
tmpvar_49 = clamp (x_48, 0.0, 1.0);
return tmpvar_49;
}
vec3 xll_saturate (
in vec3 x_50
)
{
vec3 tmpvar_51;
tmpvar_51 = clamp (x_50, 0.0, 1.0);
return tmpvar_51;
}
vec4 xll_saturate (
in vec4 x_52
)
{
vec4 tmpvar_53;
tmpvar_53 = clamp (x_52, 0.0, 1.0);
return tmpvar_53;
}
mat2 xll_saturate (
in mat2 m_54
)
{
vec2 tmpvar_55;
tmpvar_55 = clamp (m_54[0], 0.0, 1.0);
vec2 tmpvar_56;
tmpvar_56 = clamp (m_54[1], 0.0, 1.0);
mat2 tmpvar_57;
vec2 tmpvar_58;
tmpvar_58 = tmpvar_55;
tmpvar_57[0] = tmpvar_58;
vec2 tmpvar_59;
tmpvar_59 = tmpvar_56;
tmpvar_57[1] = tmpvar_59;
return tmpvar_57;
}
mat3 xll_saturate (
in mat3 m_60
)
{
vec3 tmpvar_61;
tmpvar_61 = clamp (m_60[0], 0.0, 1.0);
vec3 tmpvar_62;
tmpvar_62 = clamp (m_60[1], 0.0, 1.0);
vec3 tmpvar_63;
tmpvar_63 = clamp (m_60[2], 0.0, 1.0);
mat3 tmpvar_64;
vec3 tmpvar_65;
tmpvar_65 = tmpvar_61;
tmpvar_64[0] = tmpvar_65;
vec3 tmpvar_66;
tmpvar_66 = tmpvar_62;
tmpvar_64[1] = tmpvar_66;
vec3 tmpvar_67;
tmpvar_67 = tmpvar_63;
tmpvar_64[2] = tmpvar_67;
return tmpvar_64;
}
mat4 xll_saturate (
in mat4 m_68
)
{
vec4 tmpvar_69;
tmpvar_69 = clamp (m_68[0], 0.0, 1.0);
vec4 tmpvar_70;
tmpvar_70 = clamp (m_68[1], 0.0, 1.0);
vec4 tmpvar_71;
tmpvar_71 = clamp (m_68[2], 0.0, 1.0);
vec4 tmpvar_72;
tmpvar_72 = clamp (m_68[3], 0.0, 1.0);
mat4 tmpvar_73;
vec4 tmpvar_74;
tmpvar_74 = tmpvar_69;
tmpvar_73[0] = tmpvar_74;
vec4 tmpvar_75;
tmpvar_75 = tmpvar_70;
tmpvar_73[1] = tmpvar_75;
vec4 tmpvar_76;
tmpvar_76 = tmpvar_71;
tmpvar_73[2] = tmpvar_76;
vec4 tmpvar_77;
tmpvar_77 = tmpvar_72;
tmpvar_73[3] = tmpvar_77;
return tmpvar_73;
}
void CalcOrthonormalBasis (
in highp vec3 dir_78,
out highp vec3 right_79,
out highp vec3 up_80
)
{
highp float tmpvar_81;
tmpvar_81 = abs (dir_78.y);
vec3 tmpvar_82;
if ((tmpvar_81 > 0.999)) {
tmpvar_82 = vec3(0.0, 0.0, 1.0);
} else {
tmpvar_82 = vec3(0.0, 1.0, 0.0);
};
vec3 tmpvar_83;
tmpvar_83 = tmpvar_82;
up_80 = tmpvar_83;
highp vec3 tmpvar_84;
tmpvar_84 = cross (up_80, dir_78);
highp vec3 tmpvar_85;
tmpvar_85 = normalize (tmpvar_84);
highp vec3 tmpvar_86;
tmpvar_86 = tmpvar_85;
right_79 = tmpvar_86;
highp vec3 tmpvar_87;
tmpvar_87 = cross (dir_78, right_79);
highp vec3 tmpvar_88;
tmpvar_88 = tmpvar_87;
up_80 = tmpvar_88;
}
float CalcFadeOutFactor (
in highp float dist_89
)
{
highp float ffadeout_90;
highp float nfadeout_91;
float tmpvar_92;
tmpvar_92 = xll_saturate ((dist_89 / _FadeOutDistNear));
float tmpvar_93;
tmpvar_93 = tmpvar_92;
nfadeout_91 = tmpvar_93;
highp float tmpvar_94;
tmpvar_94 = max ((dist_89 - _FadeOutDistFar), 0.0);
float tmpvar_95;
tmpvar_95 = xll_saturate ((tmpvar_94 * 0.2));
float tmpvar_96;
tmpvar_96 = (1.0 - tmpvar_95);
ffadeout_90 = tmpvar_96;
highp float tmpvar_97;
tmpvar_97 = (ffadeout_90 * ffadeout_90);
ffadeout_90 = tmpvar_97;
highp float tmpvar_98;
tmpvar_98 = (nfadeout_91 * nfadeout_91);
nfadeout_91 = tmpvar_98;
highp float tmpvar_99;
tmpvar_99 = (nfadeout_91 * nfadeout_91);
nfadeout_91 = tmpvar_99;
highp float tmpvar_100;
tmpvar_100 = (nfadeout_91 * ffadeout_90);
nfadeout_91 = tmpvar_100;
return nfadeout_91;
}
float CalcDistScale (
in highp float dist_101
)
{
highp float distScale_102;
highp float tmpvar_103;
tmpvar_103 = max ((dist_101 - _SizeGrowStartDist), 0.0);
highp float tmpvar_104;
tmpvar_104 = min ((tmpvar_103 / _SizeGrowEndDist), 1.0);
highp float tmpvar_105;
tmpvar_105 = tmpvar_104;
distScale_102 = tmpvar_105;
return ((distScale_102 * distScale_102) * _MaxGrowSize);
}
v2f xlat_main (
in appdata_full v_106
)
{
v2f o_107;
highp float noiseWave_108;
highp float noise_109;
highp float noiseTime_110;
highp float wave_111;
highp float fracTime_112;
highp float time_113;
highp vec3 BBLocalPos_114;
highp vec3 BBNormal_115;
highp float distScale_116;
highp vec3 upLocal_117;
highp vec3 rightLocal_118;
highp float localDirLength_119;
highp vec3 localDir_120;
highp vec3 viewerLocal_121;
highp vec3 centerLocal_122;
highp vec3 centerOffs_123;
highp vec3 tmpvar_124;
tmpvar_124.z = 0.0;
tmpvar_124.xy = (vec2(0.5, 0.5) - v_106.color.xy).xy;
highp vec3 tmpvar_125;
tmpvar_125 = (tmpvar_124 * v_106.texcoord1.xyy);
centerOffs_123 = tmpvar_125;
highp vec3 tmpvar_126;
tmpvar_126 = (v_106.vertex.xyz + centerOffs_123.xyz);
centerLocal_122 = tmpvar_126;
highp vec4 tmpvar_127;
tmpvar_127.w = 1.0;
tmpvar_127.xyz = _WorldSpaceCameraPos.xyz;
highp vec3 tmpvar_128;
tmpvar_128 = (_World2Object * tmpvar_127).xyz;
highp vec3 tmpvar_129;
tmpvar_129 = tmpvar_128;
viewerLocal_121 = tmpvar_129;
highp vec3 tmpvar_130;
tmpvar_130 = (viewerLocal_121 - centerLocal_122);
localDir_120 = tmpvar_130;
highp float tmpvar_131;
tmpvar_131 = mix (0.0, localDir_120.y, _VerticalBillboarding);
highp float tmpvar_132;
tmpvar_132 = tmpvar_131;
localDir_120.y = vec2(tmpvar_132).y;
highp float tmpvar_133;
tmpvar_133 = length (localDir_120);
highp float tmpvar_134;
tmpvar_134 = tmpvar_133;
localDirLength_119 = tmpvar_134;
CalcOrthonormalBasis ((localDir_120 / localDirLength_119), rightLocal_118, upLocal_117);
highp float tmpvar_135;
tmpvar_135 = CalcDistScale (localDirLength_119);
highp float tmpvar_136;
tmpvar_136 = (tmpvar_135 * v_106.color.w);
distScale_116 = tmpvar_136;
highp vec3 tmpvar_137;
tmpvar_137 = ((rightLocal_118 * v_106.normal.x) + (upLocal_117 * v_106.normal.y));
BBNormal_115 = tmpvar_137;
highp vec3 tmpvar_138;
tmpvar_138 = ((centerLocal_122 - (
(rightLocal_118 * centerOffs_123.x)
+
(upLocal_117 * centerOffs_123.y)
)) + (BBNormal_115 * distScale_116));
BBLocalPos_114 = tmpvar_138;
highp float tmpvar_139;
tmpvar_139 = (_Time.y + (_BlinkingTimeOffsScale * v_106.color.z));
time_113 = tmpvar_139;
float tmpvar_140;
tmpvar_140 = xll_mod (time_113, (_TimeOnDuration + _TimeOffDuration));
float tmpvar_141;
tmpvar_141 = tmpvar_140;
fracTime_112 = tmpvar_141;
highp float tmpvar_142;
tmpvar_142 = smoothstep (0.0, (_TimeOnDuration * 0.25), fracTime_112);
highp float tmpvar_143;
tmpvar_143 = smoothstep ((_TimeOnDuration * 0.75), _TimeOnDuration, fracTime_112);
highp float tmpvar_144;
tmpvar_144 = (tmpvar_142 * (1.0 - tmpvar_143));
wave_111 = tmpvar_144;
highp float tmpvar_145;
tmpvar_145 = (time_113 * (6.28319 / _TimeOnDuration));
noiseTime_110 = tmpvar_145;
highp float tmpvar_146;
tmpvar_146 = sin (noiseTime_110);
highp float tmpvar_147;
tmpvar_147 = cos (((noiseTime_110 * 0.6366) + 56.7272));
highp float tmpvar_148;
tmpvar_148 = (tmpvar_146 * ((0.5 * tmpvar_147) + 0.5));
noise_109 = tmpvar_148;
highp float tmpvar_149;
tmpvar_149 = ((_NoiseAmount * noise_109) + (1.0 - _NoiseAmount));
noiseWave_108 = tmpvar_149;
highp float tmpvar_150;
if ((_NoiseAmount < 0.01)) {
tmpvar_150 = wave_111;
} else {
tmpvar_150 = noiseWave_108;
};
highp float tmpvar_151;
tmpvar_151 = tmpvar_150;
wave_111 = tmpvar_151;
highp float tmpvar_152;
tmpvar_152 = (wave_111 + _Bias);
wave_111 = tmpvar_152;
highp vec2 tmpvar_153;
tmpvar_153 = v_106.texcoord.xy;
o_107.uv = tmpvar_153;
highp vec4 tmpvar_154;
tmpvar_154.w = 1.0;
tmpvar_154.xyz = BBLocalPos_114.xyz;
highp vec4 tmpvar_155;
tmpvar_155 = (glstate_matrix_mvp * tmpvar_154);
o_107.pos = tmpvar_155;
highp float tmpvar_156;
tmpvar_156 = CalcFadeOutFactor (localDirLength_119);
highp vec4 tmpvar_157;
tmpvar_157 = (((tmpvar_156 * _Color) * _Multiplier) * wave_111);
o_107.color = tmpvar_157;
return o_107;
}
void main ()
{
appdata_full xlt_v_158;
v2f xl_retval_159;
highp vec4 tmpvar_160;
tmpvar_160 = _glesVertex.xyzw;
highp vec4 tmpvar_161;
tmpvar_161 = tmpvar_160;
xlt_v_158.vertex = tmpvar_161;
vec4 tmpvar_162;
tmpvar_162 = TANGENT.xyzw;
vec4 tmpvar_163;
tmpvar_163 = tmpvar_162;
xlt_v_158.tangent = tmpvar_163;
mediump vec3 tmpvar_164;
tmpvar_164 = _glesNormal.xyz;
mediump vec3 tmpvar_165;
tmpvar_165 = tmpvar_164;
xlt_v_158.normal = tmpvar_165;
highp vec4 tmpvar_166;
tmpvar_166 = _glesMultiTexCoord0.xyzw;
highp vec4 tmpvar_167;
tmpvar_167 = tmpvar_166;
xlt_v_158.texcoord = tmpvar_167;
highp vec4 tmpvar_168;
tmpvar_168 = _glesMultiTexCoord1.xyzw;
highp vec4 tmpvar_169;
tmpvar_169 = tmpvar_168;
xlt_v_158.texcoord1 = tmpvar_169;
lowp vec4 tmpvar_170;
tmpvar_170 = _glesColor.xyzw;
lowp vec4 tmpvar_171;
tmpvar_171 = tmpvar_170;
xlt_v_158.color = tmpvar_171;
v2f tmpvar_172;
tmpvar_172 = xlat_main (xlt_v_158);
v2f tmpvar_173;
tmpvar_173 = tmpvar_172;
xl_retval_159 = tmpvar_173;
highp vec4 tmpvar_174;
tmpvar_174 = xl_retval_159.pos.xyzw;
highp vec4 tmpvar_175;
tmpvar_175 = tmpvar_174;
xlv_SV_POSITION = tmpvar_175;
highp vec2 tmpvar_176;
tmpvar_176 = xl_retval_159.uv.xy;
highp vec2 tmpvar_177;
tmpvar_177 = tmpvar_176;
xlv_TEXCOORD0 = tmpvar_177;
lowp vec4 tmpvar_178;
tmpvar_178 = xl_retval_159.color.xyzw;
lowp vec4 tmpvar_179;
tmpvar_179 = tmpvar_178;
xlv_TEXCOORD1 = tmpvar_179;
}