#include <metal_stdlib>

using namespace metal;
uint3 textureDimensions_cc947b(texture3d<float, access::write> tint_symbol) {
  uint3 res = uint3(tint_symbol.get_width(), tint_symbol.get_height(), tint_symbol.get_depth());
  return res;
}

fragment void fragment_main(device packed_uint3* tint_symbol_1 [[buffer(0)]], texture3d<float, access::write> tint_symbol_2 [[texture(0)]]) {
  *(tint_symbol_1) = packed_uint3(textureDimensions_cc947b(tint_symbol_2));
  return;
}

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

