#include <metal_stdlib>

using namespace metal;
uint2 textureDimensions_fbb15a(texture2d<float, access::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<float, access::write> tint_symbol_2 [[texture(0)]]) {
  *(tint_symbol_1) = textureDimensions_fbb15a(tint_symbol_2);
  return;
}

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

