bgfx/3rdparty/glsl-optimizer/tests/vertex/z-prepasslight-outES3Metal.txt
2014-10-11 12:32:43 -07:00

48 lines
1.5 KiB
Text

#include <metal_stdlib>
using namespace metal;
struct xlatMtlShaderInput {
float4 _vertex [[attribute(0)]];
float3 _normal [[attribute(1)]];
};
struct xlatMtlShaderOutput {
float4 gl_Position [[position]];
float4 xlv_TEXCOORD0;
float3 xlv_TEXCOORD1;
};
struct xlatMtlShaderUniform {
float4 _ProjectionParams;
float4x4 glstate_matrix_modelview0;
float4x4 glstate_matrix_mvp;
};
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{
xlatMtlShaderOutput _mtl_o;
float4 tmpvar_1;
float3 tmpvar_2;
tmpvar_1 = (_mtl_u.glstate_matrix_mvp * _mtl_i._vertex);
float4 o_3;
o_3 = (tmpvar_1 * 0.5);
float2 tmpvar_4;
tmpvar_4.x = o_3.x;
tmpvar_4.y = (o_3.y * _mtl_u._ProjectionParams.x);
o_3.xy = (tmpvar_4 + o_3.w);
o_3.zw = tmpvar_1.zw;
tmpvar_2 = ((_mtl_u.glstate_matrix_modelview0 * _mtl_i._vertex).xyz * float3(-1.0, -1.0, 1.0));
float3 tmpvar_5;
tmpvar_5 = mix (tmpvar_2, _mtl_i._normal, float3(float((_mtl_i._normal.z != 0.0))));
tmpvar_2 = tmpvar_5;
_mtl_o.gl_Position = tmpvar_1;
_mtl_o.xlv_TEXCOORD0 = o_3;
_mtl_o.xlv_TEXCOORD1 = tmpvar_5;
return _mtl_o;
}
// stats: 9 alu 0 tex 0 flow
// inputs: 2
// #0: _vertex (high float) 4x1 [-1] loc 0
// #1: _normal (high float) 3x1 [-1] loc 1
// uniforms: 3 (total size: 144)
// #0: _ProjectionParams (high float) 4x1 [-1] loc 0
// #1: glstate_matrix_modelview0 (high float) 4x4 [-1] loc 16
// #2: glstate_matrix_mvp (high float) 4x4 [-1] loc 80