summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/3rdparty/glsl-optimizer/tests/fragment/matrix-cast-types-outES3Metal.txt
blob: f0df56748776ddac8d0345eca05e4082e9252ce0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal;
inline float4x4 _xlcast_float4x4(half4x4 v) { return float4x4(float4(v[0]), float4(v[1]), float4(v[2]), float4(v[3])); }
inline float3x3 _xlcast_float3x3(half3x3 v) { return float3x3(float3(v[0]), float3(v[1]), float3(v[2])); }
inline float2x2 _xlcast_float2x2(half2x2 v) { return float2x2(float2(v[0]), float2(v[1])); }
inline half4x4 _xlcast_half4x4(float4x4 v) { return half4x4(half4(v[0]), half4(v[1]), half4(v[2]), half4(v[3])); }
inline half3x3 _xlcast_half3x3(float3x3 v) { return half3x3(half3(v[0]), half3(v[1]), half3(v[2])); }
inline half2x2 _xlcast_half2x2(float2x2 v) { return half2x2(half2(v[0]), half2(v[1])); }
struct xlatMtlShaderInput {
  float4 xlv_TEXCOORD0;
  float4 xlv_TEXCOORD1;
  float4 xlv_TEXCOORD2;
  float4 xlv_TEXCOORD3;
};
struct xlatMtlShaderOutput {
  half4 _fragData [[color(0)]];
};
struct xlatMtlShaderUniform {
};
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]
  ,   texture2d<half> _PanelNorm [[texture(0)]], sampler _mtlsmp__PanelNorm [[sampler(0)]]
  ,   texture2d<half> _DecalNorm [[texture(1)]], sampler _mtlsmp__DecalNorm [[sampler(1)]])
{
  xlatMtlShaderOutput _mtl_o;
  half4 res_1;
  half3 worldN_2;
  half3 combinedNormal_3;
  half3 tmpvar_4;
  tmpvar_4 = ((_DecalNorm.sample(_mtlsmp__DecalNorm, (float2)(_mtl_i.xlv_TEXCOORD0.zw)).xyz * (half)2.0) - (half)1.0);
  half3 tmpvar_5;
  tmpvar_5 = ((_PanelNorm.sample(_mtlsmp__PanelNorm, (float2)(_mtl_i.xlv_TEXCOORD0.xy)).xyz * (half)2.0) - (half)1.0);
  half3 tmpvar_6;
  tmpvar_6.x = tmpvar_4.z;
  tmpvar_6.y = tmpvar_4.y;
  tmpvar_6.z = -(tmpvar_4.x);
  half3 tmpvar_7;
  tmpvar_7.x = tmpvar_4.x;
  tmpvar_7.y = tmpvar_4.z;
  tmpvar_7.z = -(tmpvar_4.y);
  float3x3 tmpvar_8;
  half3x3 tmpvar_9;
  tmpvar_9[0].x = tmpvar_6.x;
  tmpvar_9[0].y = tmpvar_7.x;
  tmpvar_9[0].z = tmpvar_4.x;
  tmpvar_9[1].x = tmpvar_6.y;
  tmpvar_9[1].y = tmpvar_7.y;
  tmpvar_9[1].z = tmpvar_4.y;
  tmpvar_9[2].x = tmpvar_6.z;
  tmpvar_9[2].y = tmpvar_7.z;
  tmpvar_9[2].z = tmpvar_4.z;
  tmpvar_8 = _xlcast_float3x3(tmpvar_9);
  float3 v_10;
  v_10.x = tmpvar_8[0].x;
  v_10.y = tmpvar_8[1].x;
  v_10.z = tmpvar_8[2].x;
  float3 v_11;
  v_11.x = tmpvar_8[0].y;
  v_11.y = tmpvar_8[1].y;
  v_11.z = tmpvar_8[2].y;
  float3 v_12;
  v_12.x = tmpvar_8[0].z;
  v_12.y = tmpvar_8[1].z;
  v_12.z = tmpvar_8[2].z;
  combinedNormal_3 = normalize(((
    ((half3)((float)tmpvar_5.x * v_10))
   + 
    ((half3)((float)tmpvar_5.y * v_11))
  ) + ((half3)((float)tmpvar_5.z * v_12))));
  float tmpvar_13;
  tmpvar_13 = dot (_mtl_i.xlv_TEXCOORD1.xyz, (float3)combinedNormal_3);
  worldN_2.x = half(tmpvar_13);
  float tmpvar_14;
  tmpvar_14 = dot (_mtl_i.xlv_TEXCOORD2.xyz, (float3)combinedNormal_3);
  worldN_2.y = half(tmpvar_14);
  float tmpvar_15;
  tmpvar_15 = dot (_mtl_i.xlv_TEXCOORD3.xyz, (float3)combinedNormal_3);
  worldN_2.z = half(tmpvar_15);
  res_1.xyz = ((worldN_2 * (half)0.5) + (half)0.5);
  res_1.w = half(0.0);
  _mtl_o._fragData = res_1;
  return _mtl_o;
}


// stats: 18 alu 2 tex 0 flow
// inputs: 4
//  #0: xlv_TEXCOORD0 (high float) 4x1 [-1]
//  #1: xlv_TEXCOORD1 (high float) 4x1 [-1]
//  #2: xlv_TEXCOORD2 (high float) 4x1 [-1]
//  #3: xlv_TEXCOORD3 (high float) 4x1 [-1]
// textures: 2
//  #0: _PanelNorm (low 2d) 0x0 [-1] loc 0
//  #1: _DecalNorm (low 2d) 0x0 [-1] loc 1