//
// fragment_main
//
#include <metal_stdlib>
using namespace metal;

struct tint_module_vars_struct {
  device float4* prevent_dce;
  texture2d_array<float, access::read> arg_0;
};

float4 textureLoad_103d9f(tint_module_vars_struct tint_module_vars) {
  uint const v = min(uint(1), (tint_module_vars.arg_0.get_array_size() - 1u));
  uint2 const v_1 = (uint2(tint_module_vars.arg_0.get_width(0u), tint_module_vars.arg_0.get_height(0u)) - uint2(1u));
  float4 res = tint_module_vars.arg_0.read(min(uint2(int2(1)), v_1), v);
  return res;
}

fragment void fragment_main(device float4* prevent_dce [[buffer(0)]], texture2d_array<float, access::read> 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) = textureLoad_103d9f(tint_module_vars);
}
//
// compute_main
//
#include <metal_stdlib>
using namespace metal;

struct tint_module_vars_struct {
  device float4* prevent_dce;
  texture2d_array<float, access::read> arg_0;
};

float4 textureLoad_103d9f(tint_module_vars_struct tint_module_vars) {
  uint const v = min(uint(1), (tint_module_vars.arg_0.get_array_size() - 1u));
  uint2 const v_1 = (uint2(tint_module_vars.arg_0.get_width(0u), tint_module_vars.arg_0.get_height(0u)) - uint2(1u));
  float4 res = tint_module_vars.arg_0.read(min(uint2(int2(1)), v_1), v);
  return res;
}

[[max_total_threads_per_threadgroup(1)]]
kernel void compute_main(device float4* prevent_dce [[buffer(0)]], texture2d_array<float, access::read> 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) = textureLoad_103d9f(tint_module_vars);
}
//
// vertex_main
//
#include <metal_stdlib>
using namespace metal;

struct tint_module_vars_struct {
  texture2d_array<float, access::read> arg_0;
};

struct VertexOutput {
  float4 pos;
  float4 prevent_dce;
};

struct vertex_main_outputs {
  float4 VertexOutput_pos [[position]];
  float4 VertexOutput_prevent_dce [[user(locn0)]] [[flat]];
};

float4 textureLoad_103d9f(tint_module_vars_struct tint_module_vars) {
  uint const v = min(uint(1), (tint_module_vars.arg_0.get_array_size() - 1u));
  uint2 const v_1 = (uint2(tint_module_vars.arg_0.get_width(0u), tint_module_vars.arg_0.get_height(0u)) - uint2(1u));
  float4 res = tint_module_vars.arg_0.read(min(uint2(int2(1)), v_1), v);
  return res;
}

VertexOutput vertex_main_inner(tint_module_vars_struct tint_module_vars) {
  VertexOutput out = {};
  out.pos = float4(0.0f);
  out.prevent_dce = textureLoad_103d9f(tint_module_vars);
  return out;
}

vertex vertex_main_outputs vertex_main(texture2d_array<float, access::read> arg_0 [[texture(0)]]) {
  tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.arg_0=arg_0};
  VertexOutput const v_2 = vertex_main_inner(tint_module_vars);
  vertex_main_outputs tint_wrapper_result = {};
  tint_wrapper_result.VertexOutput_pos = v_2.pos;
  tint_wrapper_result.VertexOutput_prevent_dce = v_2.prevent_dce;
  return tint_wrapper_result;
}
