#include <metal_stdlib>

using namespace metal;
uint2 textureDimensions_3bf12a(texture2d_array<float, access::read_write> tint_symbol) {
  uint2 res = uint2(tint_symbol.get_width(), tint_symbol.get_height());
  return res;
}

fragment void fragment_main(device uint2* tint_symbol_1 [[buffer(0)]], texture2d_array<float, access::read_write> tint_symbol_2 [[texture(0)]]) {
  *(tint_symbol_1) = textureDimensions_3bf12a(tint_symbol_2);
  return;
}

kernel void compute_main(device uint2* tint_symbol_3 [[buffer(0)]], texture2d_array<float, access::read_write> tint_symbol_4 [[texture(0)]]) {
  *(tint_symbol_3) = textureDimensions_3bf12a(tint_symbol_4);
  return;
}

