#include <metal_stdlib>
#pragma clang diagnostic ignored "-Wparentheses-equality"
using namespace metal;
constexpr sampler _mtl_xl_shadow_sampler(address::clamp_to_edge, filter::linear, compare_func::less_equal);
struct xlatMtlShaderInput {
  float4 uvHi;
  half4 uvMed;
};
struct xlatMtlShaderOutput {
  half4 _fragColor [[color(0)]];
};
struct xlatMtlShaderUniform {
};
;
fragment xlatMtlShaderOutput xlatMtlMain (xlatMtlShaderInput _mtl_i [[stage_in]], constant xlatMtlShaderUniform& _mtl_u [[buffer(0)]]
  ,   depth2d<float> shadowmap [[texture(0)]], sampler _mtlsmp_shadowmap [[sampler(0)]])
{
  xlatMtlShaderOutput _mtl_o;
  half4 r_1 = 0;
  half4 tmpvar_2 = 0;
  tmpvar_2 = half4((shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi.xyz).xy, saturate((float)(_mtl_i.uvHi.xyz).z)) + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvHi).xy / (float)(_mtl_i.uvHi).w, saturate((float)(_mtl_i.uvHi).z / (float)(_mtl_i.uvHi).w))));
  r_1.yzw = tmpvar_2.yzw;
  r_1.x = (tmpvar_2.x + shadowmap.sample_compare(_mtl_xl_shadow_sampler, (float2)(_mtl_i.uvMed.xyz).xy, saturate((float)(_mtl_i.uvMed.xyz).z)));
  _mtl_o._fragColor = r_1;
  return _mtl_o;
}


// stats: 2 alu 3 tex 0 flow
// inputs: 2
//  #0: uvHi (high float) 4x1 [-1]
//  #1: uvMed (medium float) 4x1 [-1]
// textures: 1
//  #0: shadowmap (low 2dshadow) 0x0 [-1] loc 0
