#include <metal_stdlib>

using namespace metal;
float textureSampleCompare_1912e5(depthcube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
  float res = tint_symbol.sample_compare(tint_symbol_1, float3(1.0f), 1u, 1.0f);
  return res;
}

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

