bgfx/3rdparty/glsl-optimizer/tests/vertex/z-treeleaf-outES3Metal.txt

168 lines
5.8 KiB
Text
Raw Normal View History

2014-10-11 15:32:43 -04:00
#include <metal_stdlib>
using namespace metal;
struct xlatMtlShaderInput {
float4 _inVertex [[attribute(0)]];
half3 _inNormal [[attribute(1)]];
float4 _uv0 [[attribute(2)]];
float4 _uv1 [[attribute(3)]];
half4 _color [[attribute(4)]];
half4 TANGENT [[attribute(5)]];
};
struct xlatMtlShaderOutput {
float4 gl_Position [[position]];
float2 xlv_TEXCOORD0;
half4 xlv_COLOR0;
half3 xlv_TEXCOORD1;
half3 xlv_TEXCOORD2;
half2 xlv_TEXCOORD3;
};
struct xlatMtlShaderUniform {
float4x4 _LightMatrix0;
float4 _MainTex_ST;
float4x4 _Object2World;
float4 _Scale;
float _SquashAmount;
float4 _SquashPlaneNormal;
float4 _Time;
float4 _Wind;
float4x4 _World2Object;
float3 _WorldSpaceCameraPos;
float4 _WorldSpaceLightPos0;
float4x4 glstate_matrix_invtrans_modelview0;
float4x4 glstate_matrix_mvp;
float4 unity_Scale;
};
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{
xlatMtlShaderOutput _mtl_o;
float4 tmpvar_1;
float3 tmpvar_2;
float4 tmpvar_3;
tmpvar_1 = float4(_mtl_i.TANGENT);
tmpvar_2 = float3(_mtl_i._inNormal);
tmpvar_3 = float4(_mtl_i._color);
float3 binormal_4;
float4 tmpvar_5;
float4 tmpvar_6;
float4 pos_7;
float isBillboard_8;
isBillboard_8 = (1.0 - abs(tmpvar_1.w));
float4 tmpvar_9;
tmpvar_9.w = 0.0;
tmpvar_9.xyz = tmpvar_2;
float4 tmpvar_10;
tmpvar_10.w = 0.0;
tmpvar_10.xyz = tmpvar_1.xyz;
float4 tmpvar_11;
tmpvar_11.zw = float2(0.0, 0.0);
tmpvar_11.xy = tmpvar_2.xy;
pos_7 = (_mtl_i._inVertex + ((tmpvar_11 * _mtl_u.glstate_matrix_invtrans_modelview0) * isBillboard_8));
float3 tmpvar_12;
tmpvar_12 = mix (tmpvar_2, normalize((tmpvar_9 * _mtl_u.glstate_matrix_invtrans_modelview0)).xyz, float3(isBillboard_8));
float4 tmpvar_13;
tmpvar_13.w = -1.0;
tmpvar_13.xyz = normalize((tmpvar_10 * _mtl_u.glstate_matrix_invtrans_modelview0)).xyz;
float4 tmpvar_14;
tmpvar_14 = mix (tmpvar_1, tmpvar_13, float4(isBillboard_8));
tmpvar_5.w = pos_7.w;
tmpvar_6.w = tmpvar_14.w;
tmpvar_5.xyz = (pos_7.xyz * _mtl_u._Scale.xyz);
float4 pos_15;
pos_15.w = tmpvar_5.w;
float3 bend_16;
float2 vWavesSum_17;
float4 vWaves_18;
float fBranchPhase_19;
fBranchPhase_19 = (dot (_mtl_u._Object2World[3].xyz, float3(1.0, 1.0, 1.0)) + tmpvar_3.x);
float2 tmpvar_20;
tmpvar_20.x = dot (tmpvar_5.xyz, float3((tmpvar_3.y + fBranchPhase_19)));
tmpvar_20.y = fBranchPhase_19;
vWaves_18 = ((fract(
((_mtl_u._Time.yy + tmpvar_20).xxyy * float4(1.975, 0.793, 0.375, 0.193))
) * 2.0) - 1.0);
float4 tmpvar_21;
tmpvar_21 = abs(((
fract((vWaves_18 + 0.5))
* 2.0) - 1.0));
float4 tmpvar_22;
tmpvar_22 = ((tmpvar_21 * tmpvar_21) * (3.0 - (2.0 * tmpvar_21)));
vWaves_18 = tmpvar_22;
vWavesSum_17 = (tmpvar_22.xz + tmpvar_22.yw);
bend_16.xz = ((tmpvar_3.y * 0.1) * tmpvar_12).xz;
bend_16.y = (_mtl_i._uv1.y * 0.3);
pos_15.xyz = (tmpvar_5.xyz + ((
(vWavesSum_17.xyx * bend_16)
+
((_mtl_u._Wind.xyz * vWavesSum_17.y) * _mtl_i._uv1.y)
) * _mtl_u._Wind.w));
pos_15.xyz = (pos_15.xyz + (_mtl_i._uv1.x * _mtl_u._Wind.xyz));
float3 tmpvar_23;
tmpvar_23 = mix ((pos_15.xyz - (
(dot (_mtl_u._SquashPlaneNormal.xyz, pos_15.xyz) + _mtl_u._SquashPlaneNormal.w)
* _mtl_u._SquashPlaneNormal.xyz)), pos_15.xyz, float3(_mtl_u._SquashAmount));
float4 tmpvar_24;
tmpvar_24.w = 1.0;
tmpvar_24.xyz = tmpvar_23;
tmpvar_5 = tmpvar_24;
float4 tmpvar_25;
tmpvar_25.xyz = float3(1.0, 1.0, 1.0);
tmpvar_25.w = tmpvar_3.w;
float3 tmpvar_26;
tmpvar_26 = normalize(tmpvar_12);
tmpvar_6.xyz = normalize(tmpvar_14.xyz);
binormal_4 = (((tmpvar_26.yzx * tmpvar_6.zxy) - (tmpvar_26.zxy * tmpvar_6.yzx)) * tmpvar_14.w);
float3x3 tmpvar_27;
tmpvar_27[0].x = tmpvar_6.x;
tmpvar_27[0].y = binormal_4.x;
tmpvar_27[0].z = tmpvar_26.x;
tmpvar_27[1].x = tmpvar_6.y;
tmpvar_27[1].y = binormal_4.y;
tmpvar_27[1].z = tmpvar_26.y;
tmpvar_27[2].x = tmpvar_6.z;
tmpvar_27[2].y = binormal_4.z;
tmpvar_27[2].z = tmpvar_26.z;
float4 tmpvar_28;
tmpvar_28.w = 1.0;
tmpvar_28.xyz = _mtl_u._WorldSpaceCameraPos;
_mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * tmpvar_24);
_mtl_o.xlv_TEXCOORD0 = ((_mtl_i._uv0.xy * _mtl_u._MainTex_ST.xy) + _mtl_u._MainTex_ST.zw);
_mtl_o.xlv_COLOR0 = half4(tmpvar_25);
float3 tmpvar_29;
tmpvar_29 = (tmpvar_27 * (_mtl_u._World2Object * _mtl_u._WorldSpaceLightPos0).xyz);
_mtl_o.xlv_TEXCOORD1 = half3(tmpvar_29);
float3 tmpvar_30;
tmpvar_30 = (tmpvar_27 * ((
(_mtl_u._World2Object * tmpvar_28)
.xyz * _mtl_u.unity_Scale.w) - tmpvar_23));
_mtl_o.xlv_TEXCOORD2 = half3(tmpvar_30);
float2 tmpvar_31;
tmpvar_31 = (_mtl_u._LightMatrix0 * (_mtl_u._Object2World * tmpvar_24)).xy;
_mtl_o.xlv_TEXCOORD3 = half2(tmpvar_31);
return _mtl_o;
}
// stats: 71 alu 0 tex 0 flow
// inputs: 6
// #0: _inVertex (high float) 4x1 [-1] loc 0
// #1: _inNormal (medium float) 3x1 [-1] loc 1
// #2: _uv0 (high float) 4x1 [-1] loc 2
// #3: _uv1 (high float) 4x1 [-1] loc 3
// #4: _color (low float) 4x1 [-1] loc 4
// #5: TANGENT (medium float) 4x1 [-1] loc 5
// uniforms: 14 (total size: 464)
// #0: _LightMatrix0 (high float) 4x4 [-1] loc 0
// #1: _MainTex_ST (high float) 4x1 [-1] loc 64
// #2: _Object2World (high float) 4x4 [-1] loc 80
// #3: _Scale (high float) 4x1 [-1] loc 144
// #4: _SquashAmount (high float) 1x1 [-1] loc 160
// #5: _SquashPlaneNormal (high float) 4x1 [-1] loc 176
// #6: _Time (high float) 4x1 [-1] loc 192
// #7: _Wind (high float) 4x1 [-1] loc 208
// #8: _World2Object (high float) 4x4 [-1] loc 224
// #9: _WorldSpaceCameraPos (high float) 3x1 [-1] loc 288
// #10: _WorldSpaceLightPos0 (high float) 4x1 [-1] loc 304
// #11: glstate_matrix_invtrans_modelview0 (high float) 4x4 [-1] loc 320
// #12: glstate_matrix_mvp (high float) 4x4 [-1] loc 384
// #13: unity_Scale (high float) 4x1 [-1] loc 448