bgfx/3rdparty/glsl-optimizer/tests/fragment/zun-Tree_Editor_Leaf_Shader1-ir.txt

388 lines
8.3 KiB
Text
Raw Normal View History

2012-10-07 23:41:18 -04:00
struct LeafSurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
vec3 Translucency;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
vec4 color;
};
struct v2f_surf {
vec4 pos;
vec3 _ShadowCoord0;
vec3 _ShadowCoord1;
vec3 _ShadowCoord2;
vec3 _ShadowCoord3;
vec2 _ShadowZFade;
vec2 hip_pack0;
vec4 lop_color;
};
uniform sampler2D _BumpMap;
2014-02-11 02:06:13 -05:00
uniform float _Cutoff;
uniform sampler2D _GlossMap;
uniform vec4 _LightShadowData;
uniform vec4 _LightSplitsFar;
uniform vec4 _LightSplitsNear;
uniform sampler2D _MainTex;
uniform vec4 _ProjectionParams;
uniform sampler2D _ShadowMapTexture;
uniform float _Shininess;
uniform vec4 _TranslucencyColor;
uniform sampler2D _TranslucencyMap;
2012-10-07 23:41:18 -04:00
void xll_clip (
in float x_1
)
{
if ((x_1 < 0.0)) {
discard;
};
}
float xll_saturate (
in float x_2
)
{
float tmpvar_3;
tmpvar_3 = clamp (x_2, 0.0, 1.0);
return tmpvar_3;
}
vec2 xll_saturate (
in vec2 x_4
)
{
vec2 tmpvar_5;
tmpvar_5 = clamp (x_4, 0.0, 1.0);
return tmpvar_5;
}
vec3 xll_saturate (
in vec3 x_6
)
{
vec3 tmpvar_7;
tmpvar_7 = clamp (x_6, 0.0, 1.0);
return tmpvar_7;
}
vec4 xll_saturate (
in vec4 x_8
)
{
vec4 tmpvar_9;
tmpvar_9 = clamp (x_8, 0.0, 1.0);
return tmpvar_9;
}
mat2 xll_saturate (
in mat2 m_10
)
{
vec2 tmpvar_11;
tmpvar_11 = clamp (m_10[0], 0.0, 1.0);
vec2 tmpvar_12;
tmpvar_12 = clamp (m_10[1], 0.0, 1.0);
mat2 tmpvar_13;
vec2 tmpvar_14;
tmpvar_14 = tmpvar_11;
tmpvar_13[0] = tmpvar_14;
vec2 tmpvar_15;
tmpvar_15 = tmpvar_12;
tmpvar_13[1] = tmpvar_15;
return tmpvar_13;
}
mat3 xll_saturate (
in mat3 m_16
)
{
vec3 tmpvar_17;
tmpvar_17 = clamp (m_16[0], 0.0, 1.0);
vec3 tmpvar_18;
tmpvar_18 = clamp (m_16[1], 0.0, 1.0);
vec3 tmpvar_19;
tmpvar_19 = clamp (m_16[2], 0.0, 1.0);
mat3 tmpvar_20;
vec3 tmpvar_21;
tmpvar_21 = tmpvar_17;
tmpvar_20[0] = tmpvar_21;
vec3 tmpvar_22;
tmpvar_22 = tmpvar_18;
tmpvar_20[1] = tmpvar_22;
vec3 tmpvar_23;
tmpvar_23 = tmpvar_19;
tmpvar_20[2] = tmpvar_23;
return tmpvar_20;
}
mat4 xll_saturate (
in mat4 m_24
)
{
vec4 tmpvar_25;
tmpvar_25 = clamp (m_24[0], 0.0, 1.0);
vec4 tmpvar_26;
tmpvar_26 = clamp (m_24[1], 0.0, 1.0);
vec4 tmpvar_27;
tmpvar_27 = clamp (m_24[2], 0.0, 1.0);
vec4 tmpvar_28;
tmpvar_28 = clamp (m_24[3], 0.0, 1.0);
mat4 tmpvar_29;
vec4 tmpvar_30;
tmpvar_30 = tmpvar_25;
tmpvar_29[0] = tmpvar_30;
vec4 tmpvar_31;
tmpvar_31 = tmpvar_26;
tmpvar_29[1] = tmpvar_31;
vec4 tmpvar_32;
tmpvar_32 = tmpvar_27;
tmpvar_29[2] = tmpvar_32;
vec4 tmpvar_33;
tmpvar_33 = tmpvar_28;
tmpvar_29[3] = tmpvar_33;
return tmpvar_29;
}
vec4 UnpackNormal (
in vec4 packednormal_34
)
{
vec4 normal_35;
vec2 tmpvar_36;
tmpvar_36 = ((packednormal_34.wy * 2.0) - 1.0);
normal_35.xy = tmpvar_36.xy.xy;
float tmpvar_37;
tmpvar_37 = sqrt (((1.0 - (normal_35.x * normal_35.x)) - (normal_35.y * normal_35.y)));
float tmpvar_38;
tmpvar_38 = tmpvar_37;
normal_35.z = vec3(tmpvar_38).z;
return normal_35;
}
void surf (
in Input IN_39,
inout LeafSurfaceOutput o_40
)
{
vec4 c_41;
vec4 tmpvar_42;
tmpvar_42 = texture2D (_MainTex, IN_39.uv_MainTex);
vec4 tmpvar_43;
tmpvar_43 = tmpvar_42;
c_41 = tmpvar_43;
vec3 tmpvar_44;
tmpvar_44 = (c_41.xyz * IN_39.color.xyz);
o_40.Albedo = tmpvar_44;
vec4 tmpvar_45;
tmpvar_45 = texture2D (_TranslucencyMap, IN_39.uv_MainTex);
vec3 tmpvar_46;
tmpvar_46 = _TranslucencyColor.xyz;
vec3 tmpvar_47;
tmpvar_47 = (tmpvar_45.xyz * tmpvar_46);
o_40.Translucency = tmpvar_47;
vec4 tmpvar_48;
tmpvar_48 = texture2D (_GlossMap, IN_39.uv_MainTex);
float tmpvar_49;
tmpvar_49 = tmpvar_48.w;
o_40.Gloss = tmpvar_49;
float tmpvar_50;
tmpvar_50 = (c_41.w * IN_39.color.w);
o_40.Alpha = tmpvar_50;
float tmpvar_51;
tmpvar_51 = _Shininess;
o_40.Specular = tmpvar_51;
vec4 tmpvar_52;
tmpvar_52 = texture2D (_BumpMap, IN_39.uv_MainTex);
vec4 tmpvar_53;
tmpvar_53 = UnpackNormal (tmpvar_52);
vec3 tmpvar_54;
tmpvar_54 = tmpvar_53.xyz;
vec3 tmpvar_55;
tmpvar_55 = tmpvar_54;
o_40.Normal = tmpvar_55;
}
vec2 EncodeFloatRG (
in float v_56
)
{
vec2 enc_57;
float kEncodeBit_58;
vec2 kEncodeMul_59;
vec2 tmpvar_60;
tmpvar_60 = vec2(1.0, 255.0);
kEncodeMul_59 = tmpvar_60;
float tmpvar_61;
tmpvar_61 = 0.00392157;
kEncodeBit_58 = tmpvar_61;
vec2 tmpvar_62;
tmpvar_62 = (kEncodeMul_59 * v_56);
enc_57 = tmpvar_62;
vec2 tmpvar_63;
tmpvar_63 = fract (enc_57);
vec2 tmpvar_64;
tmpvar_64 = tmpvar_63;
enc_57 = tmpvar_64;
float tmpvar_65;
tmpvar_65 = (enc_57.x - (enc_57.y * kEncodeBit_58));
enc_57.x = tmpvar_65;
return enc_57;
}
vec4 frag_surf (
in v2f_surf IN_66
)
{
vec4 res_67;
float faded_68;
float shadow_69;
vec4 coord_70;
vec4 weights_71;
vec4 far_72;
vec4 near_73;
vec4 z_74;
LeafSurfaceOutput o_75;
Input surfIN_76;
vec2 tmpvar_77;
tmpvar_77 = IN_66.hip_pack0.xy;
surfIN_76.uv_MainTex = tmpvar_77;
vec4 tmpvar_78;
tmpvar_78 = IN_66.lop_color;
surfIN_76.color = tmpvar_78;
vec3 tmpvar_79;
tmpvar_79 = vec3(0.0, 0.0, 0.0);
o_75.Albedo = tmpvar_79;
vec3 tmpvar_80;
tmpvar_80 = vec3(0.0, 0.0, 0.0);
o_75.Emission = tmpvar_80;
float tmpvar_81;
tmpvar_81 = 0.0;
o_75.Specular = tmpvar_81;
float tmpvar_82;
tmpvar_82 = 0.0;
o_75.Alpha = tmpvar_82;
surf (surfIN_76, o_75);
xll_clip ((o_75.Alpha - _Cutoff));
vec4 tmpvar_83;
tmpvar_83 = vec4(IN_66._ShadowZFade.x);
vec4 tmpvar_84;
tmpvar_84 = tmpvar_83;
z_74 = tmpvar_84;
bvec4 tmpvar_85;
tmpvar_85 = greaterThanEqual (z_74, _LightSplitsNear);
vec4 tmpvar_86;
tmpvar_86 = vec4(tmpvar_85).xyzw;
vec4 tmpvar_87;
tmpvar_87 = tmpvar_86;
near_73 = tmpvar_87;
bvec4 tmpvar_88;
tmpvar_88 = lessThan (z_74, _LightSplitsFar);
vec4 tmpvar_89;
tmpvar_89 = vec4(tmpvar_88).xyzw;
vec4 tmpvar_90;
tmpvar_90 = tmpvar_89;
far_72 = tmpvar_90;
vec4 tmpvar_91;
tmpvar_91 = (near_73 * far_72);
weights_71 = tmpvar_91;
vec4 tmpvar_92;
tmpvar_92.w = 1.0;
2014-02-11 02:06:13 -05:00
tmpvar_92.xyz = (((
(IN_66._ShadowCoord0 * weights_71.x)
+
(IN_66._ShadowCoord1 * weights_71.y)
) + (IN_66._ShadowCoord2 * weights_71.z)) + (IN_66._ShadowCoord3 * weights_71.w)).xyz;
2012-10-07 23:41:18 -04:00
vec4 tmpvar_93;
tmpvar_93 = tmpvar_92;
coord_70 = tmpvar_93;
vec4 tmpvar_94;
tmpvar_94 = texture2D (_ShadowMapTexture, coord_70.xy);
float tmpvar_95;
if ((tmpvar_94.x < coord_70.z)) {
tmpvar_95 = _LightShadowData.x;
} else {
tmpvar_95 = 1.0;
};
float tmpvar_96;
tmpvar_96 = tmpvar_95;
shadow_69 = tmpvar_96;
float tmpvar_97;
tmpvar_97 = xll_saturate (IN_66._ShadowZFade.y);
float tmpvar_98;
tmpvar_98 = xll_saturate ((shadow_69 + tmpvar_97));
float tmpvar_99;
tmpvar_99 = tmpvar_98;
faded_68 = tmpvar_99;
float tmpvar_100;
tmpvar_100 = faded_68;
res_67.x = tmpvar_100;
float tmpvar_101;
tmpvar_101 = 1.0;
res_67.y = vec2(tmpvar_101).y;
vec2 tmpvar_102;
tmpvar_102 = EncodeFloatRG ((1.0 - (z_74 * _ProjectionParams.w)).x);
vec2 tmpvar_103;
tmpvar_103 = tmpvar_102;
res_67.zw = tmpvar_103.xxxy.zw;
return res_67;
}
void main ()
{
v2f_surf xlt_IN_104;
vec4 xl_retval_105;
vec4 tmpvar_106;
tmpvar_106 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_104.pos = tmpvar_106;
vec3 tmpvar_107;
tmpvar_107 = gl_TexCoord[0].xyz;
vec3 tmpvar_108;
tmpvar_108 = tmpvar_107;
xlt_IN_104._ShadowCoord0 = tmpvar_108;
vec3 tmpvar_109;
tmpvar_109 = gl_TexCoord[1].xyz;
vec3 tmpvar_110;
tmpvar_110 = tmpvar_109;
xlt_IN_104._ShadowCoord1 = tmpvar_110;
vec3 tmpvar_111;
tmpvar_111 = gl_TexCoord[2].xyz;
vec3 tmpvar_112;
tmpvar_112 = tmpvar_111;
xlt_IN_104._ShadowCoord2 = tmpvar_112;
vec3 tmpvar_113;
tmpvar_113 = gl_TexCoord[3].xyz;
vec3 tmpvar_114;
tmpvar_114 = tmpvar_113;
xlt_IN_104._ShadowCoord3 = tmpvar_114;
vec2 tmpvar_115;
tmpvar_115 = gl_TexCoord[4].xy;
vec2 tmpvar_116;
tmpvar_116 = tmpvar_115;
xlt_IN_104._ShadowZFade = tmpvar_116;
vec2 tmpvar_117;
tmpvar_117 = gl_TexCoord[5].xy;
vec2 tmpvar_118;
tmpvar_118 = tmpvar_117;
xlt_IN_104.hip_pack0 = tmpvar_118;
vec4 tmpvar_119;
tmpvar_119 = gl_Color.xyzw;
vec4 tmpvar_120;
tmpvar_120 = tmpvar_119;
xlt_IN_104.lop_color = tmpvar_120;
vec4 tmpvar_121;
tmpvar_121 = frag_surf (xlt_IN_104);
vec4 tmpvar_122;
tmpvar_122 = tmpvar_121;
xl_retval_105 = tmpvar_122;
vec4 tmpvar_123;
tmpvar_123 = xl_retval_105.xyzw;
vec4 tmpvar_124;
tmpvar_124 = tmpvar_123;
gl_FragData[0] = tmpvar_124;
}