#version 450

#include "extensions.comp"

#include "common.comp"
layout(local_size_x = SUBGROUP_SIZE, local_size_y = 1, local_size_z = 1) in;

#define VECTOR_STORAGE_LAYOUT_SET 1
#include "vector_storage.comp"

layout(set = 0, binding = 0) buffer ScoresData {
    writeonly float data[];
} scores;

void main() {
    uint idx = SUBGROUP_ID;
    set_target(0);
    float score = similarity(idx);
    if (subgroupElect()) {
        scores.data[idx] = score;
    }
}
