#include <metal_stdlib>

using namespace metal;
void textureStore_76affd(texture2d_array<float, access::write> tint_symbol) {
  tint_symbol.write(float4(1.0f), uint2(int2(1)), 1u);
}

fragment void fragment_main(texture2d_array<float, access::write> tint_symbol_1 [[texture(0)]]) {
  textureStore_76affd(tint_symbol_1);
  return;
}

kernel void compute_main(texture2d_array<float, access::write> tint_symbol_2 [[texture(0)]]) {
  textureStore_76affd(tint_symbol_2);
  return;
}

