#version 450

layout(push_constant) uniform PushConstants {
    vec2 viewport_size;
    vec2 _padding;
} pc;

layout(location = 0) in vec2  in_pos;
layout(location = 1) in vec2  in_uv;
layout(location = 2) in vec4  in_col;
layout(location = 3) in vec2  in_rect_min;
layout(location = 4) in vec2  in_rect_max;
layout(location = 5) in vec4  in_corner_radii;
layout(location = 6) in float in_border_thickness;
layout(location = 7) in float in_softness;
layout(location = 8) in float in_mode;

layout(location = 0) out vec2  frag_uv;
layout(location = 1) out vec4  frag_col;
layout(location = 2) out vec2  frag_rect_min;
layout(location = 3) out vec2  frag_rect_max;
layout(location = 4) out vec4  frag_corner_radii;
layout(location = 5) out float frag_border_thickness;
layout(location = 6) out float frag_softness;
layout(location = 7) out float frag_mode;
layout(location = 8) out vec2  frag_pixel_pos;

void main() {
    vec2 ndc;
    ndc.x = (in_pos.x / pc.viewport_size.x) * 2.0 - 1.0;
    ndc.y = (in_pos.y / pc.viewport_size.y) * 2.0 - 1.0; // Vulkan Y is top-down already
    gl_Position = vec4(ndc, 0.0, 1.0);

    frag_uv               = in_uv;
    frag_col              = in_col;
    frag_rect_min         = in_rect_min;
    frag_rect_max         = in_rect_max;
    frag_corner_radii     = in_corner_radii;
    frag_border_thickness = in_border_thickness;
    frag_softness         = in_softness;
    frag_mode             = in_mode;
    frag_pixel_pos        = in_pos;
}
