|
| 1 | +#include <metal_stdlib> |
| 2 | +using namespace metal; |
| 3 | +inline float4x4 _xlcast_float4x4(half4x4 v) { return float4x4(float4(v[0]), float4(v[1]), float4(v[2]), float4(v[3])); } |
| 4 | +inline float3x3 _xlcast_float3x3(half3x3 v) { return float3x3(float3(v[0]), float3(v[1]), float3(v[2])); } |
| 5 | +inline float2x2 _xlcast_float2x2(half2x2 v) { return float2x2(float2(v[0]), float2(v[1])); } |
| 6 | +inline half4x4 _xlcast_half4x4(float4x4 v) { return half4x4(half4(v[0]), half4(v[1]), half4(v[2]), half4(v[3])); } |
| 7 | +inline half3x3 _xlcast_half3x3(float3x3 v) { return half3x3(half3(v[0]), half3(v[1]), half3(v[2])); } |
| 8 | +inline half2x2 _xlcast_half2x2(float2x2 v) { return half2x2(half2(v[0]), half2(v[1])); } |
| 9 | +struct xlatMtlShaderInput { |
| 10 | + float2 uv; |
| 11 | +}; |
| 12 | +struct xlatMtlShaderOutput { |
| 13 | + half4 _fragData [[color(0)]]; |
| 14 | +}; |
| 15 | +struct xlatMtlShaderUniform { |
| 16 | + float _Speed; |
| 17 | + float4 _Time; |
| 18 | +}; |
| 19 | +fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]) |
| 20 | +{ |
| 21 | + xlatMtlShaderOutput _mtl_o; |
| 22 | + half2x2 halfMatrix_1; |
| 23 | + float2x2 rotationMatrix_2; |
| 24 | + float tmpvar_3; |
| 25 | + float tmpvar_4; |
| 26 | + tmpvar_4 = (_mtl_u._Speed * _mtl_u._Time.x); |
| 27 | + tmpvar_3 = sin(tmpvar_4); |
| 28 | + float tmpvar_5; |
| 29 | + tmpvar_5 = cos(tmpvar_4); |
| 30 | + float2x2 tmpvar_6; |
| 31 | + tmpvar_6[0].x = tmpvar_5; |
| 32 | + tmpvar_6[0].y = tmpvar_3; |
| 33 | + tmpvar_6[1].x = -(tmpvar_3); |
| 34 | + tmpvar_6[1].y = tmpvar_5; |
| 35 | + rotationMatrix_2 = (tmpvar_6 * 2.0); |
| 36 | + rotationMatrix_2 = (rotationMatrix_2 - 1.0); |
| 37 | + rotationMatrix_2 = (tmpvar_3 - rotationMatrix_2); |
| 38 | + rotationMatrix_2 = (tmpvar_5 + rotationMatrix_2); |
| 39 | + rotationMatrix_2 = (rotationMatrix_2 / tmpvar_3); |
| 40 | + float2x2 tmpvar_7; |
| 41 | + tmpvar_7[0].x = tmpvar_5; |
| 42 | + tmpvar_7[0].y = tmpvar_3; |
| 43 | + tmpvar_7[1].x = -(tmpvar_3); |
| 44 | + tmpvar_7[1].y = tmpvar_5; |
| 45 | + halfMatrix_1 = _xlcast_half2x2(tmpvar_7); |
| 46 | + halfMatrix_1 = (halfMatrix_1 * (half)2.0); |
| 47 | + halfMatrix_1 = (halfMatrix_1 - (half)1.0); |
| 48 | + halfMatrix_1 = _xlcast_half2x2(((float2x2)((half)tmpvar_3 - halfMatrix_1))); |
| 49 | + halfMatrix_1 = _xlcast_half2x2(((float2x2)((half)tmpvar_5 + halfMatrix_1))); |
| 50 | + halfMatrix_1 = _xlcast_half2x2(((float2x2)(halfMatrix_1 / (half)tmpvar_3))); |
| 51 | + float4 tmpvar_8; |
| 52 | + tmpvar_8.xy = (rotationMatrix_2 * _mtl_i.uv); |
| 53 | + tmpvar_8.zw = ((float2)(halfMatrix_1 * (half2)_mtl_i.uv)); |
| 54 | + _mtl_o._fragData = half4(tmpvar_8); |
| 55 | + return _mtl_o; |
| 56 | +} |
| 57 | + |
| 58 | + |
| 59 | +// stats: 17 alu 0 tex 0 flow |
| 60 | +// inputs: 1 |
| 61 | +// #0: uv (high float) 2x1 [-1] |
| 62 | +// uniforms: 2 (total size: 32) |
| 63 | +// #0: _Speed (high float) 1x1 [-1] loc 0 |
| 64 | +// #1: _Time (high float) 4x1 [-1] loc 16 |
0 commit comments