#include <metal_stdlib>
using namespace metal;

struct tint_module_vars_struct {
  device packed_uint3* prevent_dce;
  texture3d<float, access::read_write> arg_0;
};

uint3 textureDimensions_282978(tint_module_vars_struct tint_module_vars) {
  uint3 res = uint3(tint_module_vars.arg_0.get_width(0u), tint_module_vars.arg_0.get_height(0u), tint_module_vars.arg_0.get_depth(0u));
  return res;
}

fragment void fragment_main(device packed_uint3* prevent_dce [[buffer(0)]], texture3d<float, access::read_write> arg_0 [[texture(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_0=arg_0};
  (*tint_module_vars.prevent_dce) = packed_uint3(textureDimensions_282978(tint_module_vars));
}

kernel void compute_main(device packed_uint3* prevent_dce [[buffer(0)]], texture3d<float, access::read_write> arg_0 [[texture(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.prevent_dce=prevent_dce, .arg_0=arg_0};
  (*tint_module_vars.prevent_dce) = packed_uint3(textureDimensions_282978(tint_module_vars));
}
