#include <metal_stdlib>

using namespace metal;
float textureSample_c2f4e8(depthcube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
  float3 arg_2 = float3(1.0f);
  int arg_3 = 1;
  float res = tint_symbol.sample(tint_symbol_1, arg_2, max(0, arg_3));
  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) = textureSample_c2f4e8(tint_symbol_3, tint_symbol_4);
  return;
}

