#include <metal_stdlib>

using namespace metal;
float textureSampleCompare_dd431d(depth2d_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
  float res = tint_symbol.sample_compare(tint_symbol_1, float2(1.0f), max(0, 1), 1.0f);
  return res;
}

fragment void fragment_main(device float* tint_symbol_2 [[buffer(0)]], depth2d_array<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]]) {
  *(tint_symbol_2) = textureSampleCompare_dd431d(tint_symbol_3, tint_symbol_4);
  return;
}

