bgfx/3rdparty/glsl-optimizer/tests/vertex/opt-matrix-transpose-mul-irES.txt
2012-10-07 20:41:18 -07:00

207 lines
4.8 KiB
Text

struct v2f_surf {
highp vec4 pos;
lowp vec3 lightDir;
lowp vec3 viewDir;
lowp vec3 worldN;
};
struct appdata {
highp vec4 vertex;
highp vec4 tangent;
highp vec3 normal;
};
varying lowp vec3 varViewDir;
varying lowp vec3 varLightDir;
varying lowp vec3 varWorldN;
uniform highp vec4 unity_Scale;
uniform lowp vec4 _WorldSpaceLightPos0;
uniform highp vec3 _WorldSpaceCameraPos;
uniform highp mat4 _World2Object;
uniform highp mat4 _Object2World;
attribute vec4 attrTangent;
attribute vec3 attrNormal;
attribute vec4 attrVertex;
uniform mat4 glstate_matrix_mvp;
attribute lowp vec4 _glesColor;
attribute highp vec4 _glesMultiTexCoord1;
attribute highp vec4 _glesMultiTexCoord0;
attribute mediump vec3 _glesNormal;
attribute highp vec4 _glesVertex;
mat3 xll_transpose (
in mat3 m_1
)
{
mat3 tmpvar_2;
float tmpvar_3;
tmpvar_3 = m_1[0][0];
tmpvar_2[0].x = tmpvar_3;
float tmpvar_4;
tmpvar_4 = m_1[1][0];
tmpvar_2[0].y = tmpvar_4;
float tmpvar_5;
tmpvar_5 = m_1[2][0];
tmpvar_2[0].z = tmpvar_5;
float tmpvar_6;
tmpvar_6 = m_1[0][1];
tmpvar_2[1].x = tmpvar_6;
float tmpvar_7;
tmpvar_7 = m_1[1][1];
tmpvar_2[1].y = tmpvar_7;
float tmpvar_8;
tmpvar_8 = m_1[2][1];
tmpvar_2[1].z = tmpvar_8;
float tmpvar_9;
tmpvar_9 = m_1[0][2];
tmpvar_2[2].x = tmpvar_9;
float tmpvar_10;
tmpvar_10 = m_1[1][2];
tmpvar_2[2].y = tmpvar_10;
float tmpvar_11;
tmpvar_11 = m_1[2][2];
tmpvar_2[2].z = tmpvar_11;
return tmpvar_2;
}
mat3 xll_constructMat3 (
in mat4 m_12
)
{
vec3 tmpvar_13;
tmpvar_13 = m_12[0].xyz;
vec3 tmpvar_14;
tmpvar_14 = m_12[1].xyz;
vec3 tmpvar_15;
tmpvar_15 = m_12[2].xyz;
mat3 tmpvar_16;
vec3 tmpvar_17;
tmpvar_17 = tmpvar_13;
tmpvar_16[0] = tmpvar_17;
vec3 tmpvar_18;
tmpvar_18 = tmpvar_14;
tmpvar_16[1] = tmpvar_18;
vec3 tmpvar_19;
tmpvar_19 = tmpvar_15;
tmpvar_16[2] = tmpvar_19;
return tmpvar_16;
}
vec3 ObjSpaceViewDir (
in highp vec4 v_20
)
{
highp vec3 objSpaceCameraPos_21;
highp vec4 tmpvar_22;
tmpvar_22.w = 1.0;
tmpvar_22.xyz = _WorldSpaceCameraPos.xyz.xyz;
highp vec3 tmpvar_23;
tmpvar_23 = ((_World2Object * tmpvar_22).xyz * unity_Scale.w);
objSpaceCameraPos_21 = tmpvar_23;
return (objSpaceCameraPos_21 - v_20.xyz);
}
vec3 ObjSpaceLightDir (
in highp vec4 v_24
)
{
highp vec3 objSpaceLightPos_25;
highp vec3 tmpvar_26;
tmpvar_26 = (_World2Object * _WorldSpaceLightPos0).xyz;
objSpaceLightPos_25 = tmpvar_26;
return objSpaceLightPos_25.xyz;
}
v2f_surf vert_surf (
in appdata v_27
)
{
highp vec3 viewDirForLight_28;
highp vec3 lightDir_29;
highp mat3 rotation_30;
highp vec3 binormal_31;
highp vec3 worldN_32;
v2f_surf o_33;
highp vec4 tmpvar_34;
tmpvar_34 = (glstate_matrix_mvp * v_27.vertex);
o_33.pos = tmpvar_34;
mat3 tmpvar_35;
tmpvar_35 = xll_constructMat3 (_Object2World);
highp vec3 tmpvar_36;
tmpvar_36 = (tmpvar_35 * v_27.normal);
worldN_32 = tmpvar_36;
highp vec3 tmpvar_37;
tmpvar_37 = worldN_32;
o_33.worldN = tmpvar_37;
highp vec3 tmpvar_38;
tmpvar_38 = cross (v_27.normal, v_27.tangent.xyz);
highp vec3 tmpvar_39;
tmpvar_39 = (tmpvar_38 * v_27.tangent.w);
binormal_31 = tmpvar_39;
mat3 tmpvar_40;
vec3 tmpvar_41;
tmpvar_41 = v_27.tangent.xyz;
tmpvar_40[0] = tmpvar_41;
vec3 tmpvar_42;
tmpvar_42 = binormal_31;
tmpvar_40[1] = tmpvar_42;
vec3 tmpvar_43;
tmpvar_43 = v_27.normal;
tmpvar_40[2] = tmpvar_43;
mat3 tmpvar_44;
tmpvar_44 = xll_transpose (tmpvar_40);
mat3 tmpvar_45;
tmpvar_45 = (tmpvar_44);
rotation_30 = (tmpvar_45);
highp vec3 tmpvar_46;
tmpvar_46 = ObjSpaceLightDir (v_27.vertex);
highp vec3 tmpvar_47;
tmpvar_47 = (rotation_30 * tmpvar_46);
lightDir_29 = tmpvar_47;
highp vec3 tmpvar_48;
tmpvar_48 = lightDir_29;
o_33.lightDir = tmpvar_48;
highp vec3 tmpvar_49;
tmpvar_49 = ObjSpaceViewDir (v_27.vertex);
highp vec3 tmpvar_50;
tmpvar_50 = (rotation_30 * tmpvar_49);
viewDirForLight_28 = tmpvar_50;
highp vec3 tmpvar_51;
tmpvar_51 = normalize (viewDirForLight_28);
highp vec3 tmpvar_52;
tmpvar_52 = normalize ((lightDir_29 + tmpvar_51));
highp vec3 tmpvar_53;
tmpvar_53 = tmpvar_52;
o_33.viewDir = tmpvar_53;
return o_33;
}
void main ()
{
v2f_surf rv_54;
appdata v_55;
vec4 tmpvar_56;
tmpvar_56 = attrVertex;
v_55.vertex = tmpvar_56;
vec4 tmpvar_57;
tmpvar_57 = attrTangent;
v_55.tangent = tmpvar_57;
vec3 tmpvar_58;
tmpvar_58 = attrNormal;
v_55.normal = tmpvar_58;
v2f_surf tmpvar_59;
tmpvar_59 = vert_surf (v_55);
v2f_surf tmpvar_60;
tmpvar_60 = tmpvar_59;
rv_54 = tmpvar_60;
highp vec4 tmpvar_61;
tmpvar_61 = rv_54.pos;
gl_Position = tmpvar_61;
lowp vec3 tmpvar_62;
tmpvar_62 = rv_54.worldN;
varWorldN = tmpvar_62;
lowp vec3 tmpvar_63;
tmpvar_63 = rv_54.lightDir;
varLightDir = tmpvar_63;
lowp vec3 tmpvar_64;
tmpvar_64 = rv_54.viewDir;
varViewDir = tmpvar_64;
}