#include <metal_stdlib>
using namespace metal;

// Shared fullscreen-triangle vertex shader for the SDL3 GPU backend.
// Emits uv in Shadertoy convention: (0,0) bottom-left, (1,1) top-right.

struct PassthroughVOut {
    float4 pos [[position]];
    float2 uv;
};

vertex PassthroughVOut passthrough_vs(uint vid [[vertex_id]]) {
    const float2 positions[3] = { {-1.0, -1.0}, {3.0, -1.0}, {-1.0, 3.0} };
    PassthroughVOut out;
    float2 pos = positions[vid];
    out.uv = pos * 0.5 + 0.5;
    out.pos = float4(pos, 0.0, 1.0);
    return out;
}
