bgfx/3rdparty/glsl-optimizer/tests/vertex/bug-swizzle-lhs-cast-outES3Metal.txt

61 lines
2 KiB
Text
Raw Normal View History

2014-10-11 15:32:43 -04:00
#include <metal_stdlib>
using namespace metal;
struct xlatMtlShaderInput {
float4 _glesVertex [[attribute(0)]];
};
struct xlatMtlShaderOutput {
float4 gl_Position [[position]];
float3 xlv_TEXCOORD2;
};
struct xlatMtlShaderUniform {
float3 _WorldSpaceCameraPos;
float4x4 glstate_matrix_mvp;
float4x4 _World2Object;
float3 _TerrainTreeLightDirections[4];
};
vertex xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]])
{
xlatMtlShaderOutput _mtl_o;
float3 viewDir_1;
float3 tmpvar_2;
float4 tmpvar_3;
tmpvar_3.w = 1.0;
tmpvar_3.xyz = _mtl_u._WorldSpaceCameraPos;
viewDir_1 = normalize(((_mtl_u._World2Object * tmpvar_3).xyz - _mtl_i._glesVertex.xyz));
2015-04-03 02:30:48 -04:00
half tmpvar_4;
2014-10-11 15:32:43 -04:00
float tmpvar_5;
tmpvar_5 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[0])), 0.0, 1.0);
2015-04-03 02:30:48 -04:00
tmpvar_4 = half(tmpvar_5);
2014-10-11 15:32:43 -04:00
float3 tmpvar_6;
tmpvar_6.yz = tmpvar_2.yz;
2015-04-03 02:30:48 -04:00
tmpvar_6.x = float((tmpvar_4 * (half)2.0));
half tmpvar_7;
2014-10-11 15:32:43 -04:00
float tmpvar_8;
tmpvar_8 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[1])), 0.0, 1.0);
2015-04-03 02:30:48 -04:00
tmpvar_7 = half(tmpvar_8);
2014-10-11 15:32:43 -04:00
float3 tmpvar_9;
tmpvar_9.xz = tmpvar_6.xz;
2015-04-03 02:30:48 -04:00
tmpvar_9.y = float((tmpvar_7 * (half)2.0));
half tmpvar_10;
2014-10-11 15:32:43 -04:00
float tmpvar_11;
tmpvar_11 = clamp (dot (viewDir_1, -(_mtl_u._TerrainTreeLightDirections[2])), 0.0, 1.0);
2015-04-03 02:30:48 -04:00
tmpvar_10 = half(tmpvar_11);
2014-10-11 15:32:43 -04:00
float3 tmpvar_12;
tmpvar_12.xy = tmpvar_9.xy;
2015-04-03 02:30:48 -04:00
tmpvar_12.z = float((tmpvar_10 * (half)2.0));
2014-10-11 15:32:43 -04:00
tmpvar_2 = tmpvar_12;
_mtl_o.gl_Position = (_mtl_u.glstate_matrix_mvp * _mtl_i._glesVertex);
_mtl_o.xlv_TEXCOORD2 = tmpvar_12;
return _mtl_o;
}
// stats: 17 alu 0 tex 0 flow
// inputs: 1
// #0: _glesVertex (high float) 4x1 [-1] loc 0
// uniforms: 4 (total size: 208)
// #0: _WorldSpaceCameraPos (high float) 3x1 [-1] loc 0
// #1: glstate_matrix_mvp (high float) 4x4 [-1] loc 16
// #2: _World2Object (high float) 4x4 [-1] loc 80
// #3: _TerrainTreeLightDirections (high float) 3x1 [4] loc 144