#include <metal_stdlib>

using namespace metal;
float4 textureSampleBias_eed7c4(texturecube_array<float, access::sample> tint_symbol, sampler tint_symbol_1) {
  float3 arg_2 = float3(1.0f);
  int arg_3 = 1;
  float arg_4 = 1.0f;
  float4 res = tint_symbol.sample(tint_symbol_1, arg_2, max(0, arg_3), bias(arg_4));
  return res;
}

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

