// stock::vector — tessellated SVG/vector geometry. CPU-side SVG assets
// are normalised into Aetna vector IR and tessellated into triangles;
// silhouette AA is delegated to the host's MSAA target, not done in
// the shader.
struct FrameUniforms {
viewport: vec2<f32>,
time: f32,
scale_factor: f32,
};
@group(0) @binding(0) var<uniform> frame: FrameUniforms;
struct VertexInput {
@location(0) pos_px: vec2<f32>,
@location(1) local: vec2<f32>,
@location(2) color: vec4<f32>,
@location(3) data: vec4<f32>,
};
struct VertexOutput {
@builtin(position) clip_pos: vec4<f32>,
@location(0) color: vec4<f32>,
@location(1) local: vec2<f32>,
@location(2) data: vec4<f32>,
};
@vertex
fn vs_main(in: VertexInput) -> VertexOutput {
let clip = vec4<f32>(
in.pos_px.x / frame.viewport.x * 2.0 - 1.0,
1.0 - in.pos_px.y / frame.viewport.y * 2.0,
0.0,
1.0,
);
var out: VertexOutput;
out.clip_pos = clip;
out.color = in.color;
out.local = in.local;
out.data = in.data;
return out;
}
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return vec4<f32>(in.color.rgb * in.color.a, in.color.a);
}