#version 460
#extension GL_EXT_buffer_reference : require

struct Vertex {
    vec2 pos;
    vec2 uv;
    vec4 color;
    float alpha;
    uint textureID;
};

layout(location = 0) in vec2 inPos;       // Matches VK_FORMAT_R32G32_SFLOAT
layout(location = 1) in vec2 inTexCoord;  // Matches VK_FORMAT_R32G32_SFLOAT
layout(location = 2) in vec4 inColor;     // Matches VK_FORMAT_R32G32B32A32_SFLOAT
layout(location = 3) in float inAlpha;    // Matches VK_FORMAT_R32_SFLOAT
layout(location = 4) in uint inTextureID; // Matches VK_FORMAT_R32_UINT

//layout(std430, set = 0, binding = 1) readonly buffer VertexBuffer {
//    Vertex vertices[];
//} vBuf;

//layout(buffer_reference, std430) readonly buffer VertexBuffer{
//    Vertex vertices[];
//};

//push constants block
//layout(push_constant) uniform constants {
//    mat4 render_matrix;
//    VertexBuffer vertexBuffer;
//} PushConstants;

layout(location = 0) out vec2 uv;
layout(location = 1) out vec4 color;
layout(location = 2) out float alpha;
layout(location = 3) out flat uint tex_id;

void main() {

    uv = inTexCoord;
    color = inColor;
    alpha = inAlpha;
    tex_id = inTextureID;
    gl_Position = vec4(inPos, 0.0, 1.0);
}
