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

294 lines
6.0 KiB
Plaintext
Raw Normal View History

2012-10-08 07:41:18 +04:00
struct SurfaceOutput {
vec3 Albedo;
vec3 Normal;
vec3 Emission;
float Specular;
float Gloss;
float Alpha;
};
struct Input {
vec2 uv_MainTex;
};
struct v2f_surf {
vec4 pos;
float fog;
vec2 hip_pack0;
vec4 hip_screen;
vec3 hip_lmapFade;
};
uniform vec4 _Color;
2014-02-11 11:06:13 +04:00
uniform sampler2D _LightBuffer;
uniform sampler2D _MainTex;
uniform float _Shininess;
uniform vec4 _SpecColor;
uniform sampler2D unity_Lightmap;
uniform sampler2D unity_LightmapInd;
varying vec4 xlv_FOG;
2012-10-08 07:41:18 +04:00
float xll_saturate (
in float x_1
)
{
float tmpvar_2;
tmpvar_2 = clamp (x_1, 0.0, 1.0);
return tmpvar_2;
}
vec2 xll_saturate (
in vec2 x_3
)
{
vec2 tmpvar_4;
tmpvar_4 = clamp (x_3, 0.0, 1.0);
return tmpvar_4;
}
vec3 xll_saturate (
in vec3 x_5
)
{
vec3 tmpvar_6;
tmpvar_6 = clamp (x_5, 0.0, 1.0);
return tmpvar_6;
}
vec4 xll_saturate (
in vec4 x_7
)
{
vec4 tmpvar_8;
tmpvar_8 = clamp (x_7, 0.0, 1.0);
return tmpvar_8;
}
mat2 xll_saturate (
in mat2 m_9
)
{
vec2 tmpvar_10;
tmpvar_10 = clamp (m_9[0], 0.0, 1.0);
vec2 tmpvar_11;
tmpvar_11 = clamp (m_9[1], 0.0, 1.0);
mat2 tmpvar_12;
vec2 tmpvar_13;
tmpvar_13 = tmpvar_10;
tmpvar_12[0] = tmpvar_13;
vec2 tmpvar_14;
tmpvar_14 = tmpvar_11;
tmpvar_12[1] = tmpvar_14;
return tmpvar_12;
}
mat3 xll_saturate (
in mat3 m_15
)
{
vec3 tmpvar_16;
tmpvar_16 = clamp (m_15[0], 0.0, 1.0);
vec3 tmpvar_17;
tmpvar_17 = clamp (m_15[1], 0.0, 1.0);
vec3 tmpvar_18;
tmpvar_18 = clamp (m_15[2], 0.0, 1.0);
mat3 tmpvar_19;
vec3 tmpvar_20;
tmpvar_20 = tmpvar_16;
tmpvar_19[0] = tmpvar_20;
vec3 tmpvar_21;
tmpvar_21 = tmpvar_17;
tmpvar_19[1] = tmpvar_21;
vec3 tmpvar_22;
tmpvar_22 = tmpvar_18;
tmpvar_19[2] = tmpvar_22;
return tmpvar_19;
}
mat4 xll_saturate (
in mat4 m_23
)
{
vec4 tmpvar_24;
tmpvar_24 = clamp (m_23[0], 0.0, 1.0);
vec4 tmpvar_25;
tmpvar_25 = clamp (m_23[1], 0.0, 1.0);
vec4 tmpvar_26;
tmpvar_26 = clamp (m_23[2], 0.0, 1.0);
vec4 tmpvar_27;
tmpvar_27 = clamp (m_23[3], 0.0, 1.0);
mat4 tmpvar_28;
vec4 tmpvar_29;
tmpvar_29 = tmpvar_24;
tmpvar_28[0] = tmpvar_29;
vec4 tmpvar_30;
tmpvar_30 = tmpvar_25;
tmpvar_28[1] = tmpvar_30;
vec4 tmpvar_31;
tmpvar_31 = tmpvar_26;
tmpvar_28[2] = tmpvar_31;
vec4 tmpvar_32;
tmpvar_32 = tmpvar_27;
tmpvar_28[3] = tmpvar_32;
return tmpvar_28;
}
void surf (
in Input IN_33,
inout SurfaceOutput o_34
)
{
vec4 tex_35;
vec4 tmpvar_36;
tmpvar_36 = texture2D (_MainTex, IN_33.uv_MainTex);
vec4 tmpvar_37;
tmpvar_37 = tmpvar_36;
tex_35 = tmpvar_37;
vec3 tmpvar_38;
tmpvar_38 = (tex_35.xyz * _Color.xyz);
o_34.Albedo = tmpvar_38;
float tmpvar_39;
tmpvar_39 = tex_35.w;
o_34.Gloss = tmpvar_39;
float tmpvar_40;
tmpvar_40 = (tex_35.w * _Color.w);
o_34.Alpha = tmpvar_40;
float tmpvar_41;
tmpvar_41 = _Shininess;
o_34.Specular = tmpvar_41;
}
vec4 LightingBlinnPhong_PrePass (
in SurfaceOutput s_42,
in vec4 light_43
)
{
vec4 c_44;
float spec_45;
float tmpvar_46;
tmpvar_46 = (light_43.w * s_42.Gloss);
spec_45 = tmpvar_46;
vec3 tmpvar_47;
tmpvar_47 = ((s_42.Albedo * light_43.xyz) + ((light_43.xyz * _SpecColor.xyz) * spec_45));
c_44.xyz = tmpvar_47.xyz.xyz;
float tmpvar_48;
tmpvar_48 = (s_42.Alpha + (spec_45 * _SpecColor.w));
c_44.w = vec4(tmpvar_48).w;
return c_44;
}
vec3 DecodeLightmap (
in vec4 color_49
)
{
return (2.0 * color_49.xyz);
}
vec4 frag_surf (
in v2f_surf IN_50
)
{
vec4 col_51;
vec3 lm_52;
vec3 lmIndirect_53;
vec3 lmFull_54;
vec4 light_55;
SurfaceOutput o_56;
Input surfIN_57;
vec2 tmpvar_58;
tmpvar_58 = IN_50.hip_pack0.xy;
surfIN_57.uv_MainTex = tmpvar_58;
vec3 tmpvar_59;
tmpvar_59 = vec3(0.0, 0.0, 0.0);
o_56.Albedo = tmpvar_59;
vec3 tmpvar_60;
tmpvar_60 = vec3(0.0, 0.0, 0.0);
o_56.Emission = tmpvar_60;
float tmpvar_61;
tmpvar_61 = 0.0;
o_56.Specular = tmpvar_61;
float tmpvar_62;
tmpvar_62 = 0.0;
o_56.Alpha = tmpvar_62;
float tmpvar_63;
tmpvar_63 = 0.0;
o_56.Gloss = tmpvar_63;
surf (surfIN_57, o_56);
vec4 tmpvar_64;
tmpvar_64 = texture2DProj (_LightBuffer, IN_50.hip_screen);
vec4 tmpvar_65;
tmpvar_65 = tmpvar_64;
light_55 = tmpvar_65;
vec4 tmpvar_66;
tmpvar_66 = log2 (light_55);
vec4 tmpvar_67;
tmpvar_67 = -(tmpvar_66);
light_55 = tmpvar_67;
vec4 tmpvar_68;
tmpvar_68 = texture2D (unity_Lightmap, IN_50.hip_lmapFade.xy);
vec3 tmpvar_69;
tmpvar_69 = DecodeLightmap (tmpvar_68);
vec3 tmpvar_70;
tmpvar_70 = tmpvar_69;
lmFull_54 = tmpvar_70;
vec4 tmpvar_71;
tmpvar_71 = texture2D (unity_LightmapInd, IN_50.hip_lmapFade.xy);
vec3 tmpvar_72;
tmpvar_72 = DecodeLightmap (tmpvar_71);
vec3 tmpvar_73;
tmpvar_73 = tmpvar_72;
lmIndirect_53 = tmpvar_73;
float tmpvar_74;
tmpvar_74 = xll_saturate (IN_50.hip_lmapFade.z);
vec3 tmpvar_75;
tmpvar_75 = vec3(tmpvar_74);
vec3 tmpvar_76;
tmpvar_76 = mix (lmIndirect_53, lmFull_54, tmpvar_75);
vec3 tmpvar_77;
tmpvar_77 = tmpvar_76;
lm_52 = tmpvar_77;
vec3 tmpvar_78;
tmpvar_78 = (light_55.xyz + lm_52);
light_55.xyz = tmpvar_78.xyz.xyz;
vec4 tmpvar_79;
tmpvar_79 = LightingBlinnPhong_PrePass (o_56, light_55);
vec4 tmpvar_80;
tmpvar_80 = tmpvar_79;
col_51 = tmpvar_80;
return col_51;
}
void main ()
{
v2f_surf xlt_IN_81;
vec4 xl_retval_82;
vec4 tmpvar_83;
tmpvar_83 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_IN_81.pos = tmpvar_83;
float tmpvar_84;
tmpvar_84 = xlv_FOG.x;
xlt_IN_81.fog = tmpvar_84;
vec2 tmpvar_85;
tmpvar_85 = gl_TexCoord[0].xy;
vec2 tmpvar_86;
tmpvar_86 = tmpvar_85;
xlt_IN_81.hip_pack0 = tmpvar_86;
vec4 tmpvar_87;
tmpvar_87 = gl_TexCoord[1].xyzw;
vec4 tmpvar_88;
tmpvar_88 = tmpvar_87;
xlt_IN_81.hip_screen = tmpvar_88;
vec3 tmpvar_89;
tmpvar_89 = gl_TexCoord[2].xyz;
vec3 tmpvar_90;
tmpvar_90 = tmpvar_89;
xlt_IN_81.hip_lmapFade = tmpvar_90;
vec4 tmpvar_91;
tmpvar_91 = frag_surf (xlt_IN_81);
vec4 tmpvar_92;
tmpvar_92 = tmpvar_91;
xl_retval_82 = tmpvar_92;
vec4 tmpvar_93;
tmpvar_93 = xl_retval_82.xyzw;
vec4 tmpvar_94;
tmpvar_94 = tmpvar_93;
gl_FragData[0] = tmpvar_94;
}