1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
struct VertexInput {
@location(0) position: vec3<f32>,
@location(1) uv: vec2<f32>,
}
struct Interpolated {
@builtin(position) position: vec4<f32>,
@location(0) uv: vec2<f32>,
@location(1) normal: vec3<f32>,
}
struct Interpolated {
@location(0) uv: vec2<f32>,
@location(1) normal: vec3<f32>,
}
struct FragmentOutput {
@location(0) color: vec4<f32>,
}
struct Uniforms {
mvp: mat4x4<f32>,
}
@group(0) @binding(0) var<uniform> uniforms: Uniforms;
@vertex
fn vs_main(input: VertexInput) -> Interpolated {
var __luma_output: Interpolated;
let clip_pos = (uniforms.mvp * vec4<f32>(input.position, 1.0));
__luma_output.position = clip_pos;
__luma_output.uv = input.uv;
__luma_output.normal = vec3<f32>(0.0, 1.0, 0.0);
return __luma_output;
}
@fragment
fn fs_main(input: Interpolated) -> FragmentOutput {
var __luma_output: FragmentOutput;
__luma_output.color = vec4<f32>(input.uv, 0.0, 1.0);
return __luma_output;
}