#include #pragma clang diagnostic ignored "-Wparentheses-equality" using namespace metal; struct xlatMtlShaderInput { float2 xlv_TEXCOORD0; float3 xlv_TEXCOORD1; }; struct xlatMtlShaderOutput { half4 _fragData [[color(0)]]; }; struct xlatMtlShaderUniform { float4 _LightShadowData; float4 _LightSplitsFar; float4 _LightSplitsNear; float4x4 _View2Shadow; float4x4 _View2Shadow1; float4x4 _View2Shadow2; float4x4 _View2Shadow3; float4 _ZBufferParams; }; fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]] , texture2d _CameraDepthTexture [[texture(0)]], sampler _mtlsmp__CameraDepthTexture [[sampler(0)]] , texture2d _ShadowMapTexture [[texture(1)]], sampler _mtlsmp__ShadowMapTexture [[sampler(1)]]) { xlatMtlShaderOutput _mtl_o; half4 tmpvar_1 = 0; float4 res_2 = 0; float depth_3 = 0; half4 tmpvar_4 = 0; tmpvar_4 = _CameraDepthTexture.sample(_mtlsmp__CameraDepthTexture, (float2)(_mtl_i.xlv_TEXCOORD0)); depth_3 = float(tmpvar_4.x); float tmpvar_5 = 0; tmpvar_5 = (1.0/(((_mtl_u._ZBufferParams.x * depth_3) + _mtl_u._ZBufferParams.y))); depth_3 = tmpvar_5; float4 tmpvar_6 = 0; tmpvar_6.w = 1.0; tmpvar_6.xyz = (_mtl_i.xlv_TEXCOORD1 * tmpvar_5); half shadow_7 = 0; float4 weights_8 = 0; float4 far_9 = 0; float4 near_10 = 0; bool4 tmpvar_11 = false; tmpvar_11 = bool4((tmpvar_6.zzzz >= _mtl_u._LightSplitsNear)); half4 tmpvar_12 = 0; tmpvar_12 = half4(tmpvar_11); near_10 = float4(tmpvar_12); bool4 tmpvar_13 = false; tmpvar_13 = bool4((tmpvar_6.zzzz < _mtl_u._LightSplitsFar)); half4 tmpvar_14 = 0; tmpvar_14 = half4(tmpvar_13); far_9 = float4(tmpvar_14); weights_8 = (near_10 * far_9); float4 tmpvar_15 = 0; tmpvar_15.w = 1.0; tmpvar_15.xyz = ((( ((_mtl_u._View2Shadow * tmpvar_6).xyz * weights_8.x) + ((_mtl_u._View2Shadow1 * tmpvar_6).xyz * weights_8.y) ) + ( (_mtl_u._View2Shadow2 * tmpvar_6) .xyz * weights_8.z)) + ((_mtl_u._View2Shadow3 * tmpvar_6).xyz * weights_8.w)); half4 tmpvar_16 = 0; tmpvar_16 = _ShadowMapTexture.sample(_mtlsmp__ShadowMapTexture, (float2)(tmpvar_15.xy)); float tmpvar_17 = 0; if (((float)(tmpvar_16.x) < tmpvar_15.z)) { tmpvar_17 = _mtl_u._LightShadowData.x; } else { tmpvar_17 = 1.0; }; shadow_7 = half(tmpvar_17); res_2.x = float(shadow_7); res_2.y = 1.0; float2 enc_18 = 0; enc_18 = (float2(1.0, 255.0) * (1.0 - tmpvar_5)); float2 tmpvar_19 = 0; tmpvar_19 = fract(enc_18); enc_18.y = tmpvar_19.y; enc_18.x = (tmpvar_19.x - (tmpvar_19.y * 0.00392157)); res_2.zw = enc_18; tmpvar_1 = half4(res_2); _mtl_o._fragData = tmpvar_1; return _mtl_o; } // stats: 30 alu 2 tex 1 flow // inputs: 2 // #0: xlv_TEXCOORD0 (high float) 2x1 [-1] // #1: xlv_TEXCOORD1 (high float) 3x1 [-1] // uniforms: 8 (total size: 320) // #0: _LightShadowData (high float) 4x1 [-1] loc 0 // #1: _LightSplitsFar (high float) 4x1 [-1] loc 16 // #2: _LightSplitsNear (high float) 4x1 [-1] loc 32 // #3: _View2Shadow (high float) 4x4 [-1] loc 48 // #4: _View2Shadow1 (high float) 4x4 [-1] loc 112 // #5: _View2Shadow2 (high float) 4x4 [-1] loc 176 // #6: _View2Shadow3 (high float) 4x4 [-1] loc 240 // #7: _ZBufferParams (high float) 4x1 [-1] loc 304 // textures: 2 // #0: _CameraDepthTexture (low 2d) 0x0 [-1] loc 0 // #1: _ShadowMapTexture (low 2d) 0x0 [-1] loc 1