src/shaders.wgsl
1struct VertexInput {
2 @location(0) position: vec2f,
3 @location(1) color: vec4f,
4};
5
6struct VertexOutput {
7 @builtin(position) position: vec4f,
8 // Passed to the fragment shader
9 @location(0) color: vec4f,
10};
11
12@vertex
13fn vertex_shader(in: VertexInput) -> VertexOutput {
14 var out: VertexOutput;
15 out.position = vec4f(in.position, 0.0, 1.0);
16 out.color = in.color;
17 return out;
18}
19
20@fragment
21fn fragment_shader(in: VertexOutput) -> @location(0) vec4f {
22 return in.color;
23}