diff options
author | 2021-04-11 18:55:57 -0700 | |
---|---|---|
committer | 2021-04-11 18:55:57 -0700 | |
commit | 9a2c78c4059d2be37d10adda397fb6e64f38ac02 (patch) | |
tree | f529faa116378e7ab447b40bd93bf5811c3dfca8 /wgpu/src/shader/triangle.wgsl | |
parent | 4b8ba8309f6645cdcb5bd605f8dd88097f8ee5a7 (diff) | |
download | iced-9a2c78c4059d2be37d10adda397fb6e64f38ac02.tar.gz iced-9a2c78c4059d2be37d10adda397fb6e64f38ac02.tar.bz2 iced-9a2c78c4059d2be37d10adda397fb6e64f38ac02.zip |
Upgrade wgpu
Diffstat (limited to '')
-rw-r--r-- | wgpu/src/shader/triangle.wgsl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/wgpu/src/shader/triangle.wgsl b/wgpu/src/shader/triangle.wgsl new file mode 100644 index 00000000..96eaabcc --- /dev/null +++ b/wgpu/src/shader/triangle.wgsl @@ -0,0 +1,31 @@ +[[block]] +struct Globals { + transform: mat4x4<f32>; +}; + +[[group(0), binding(0)]] var<uniform> globals: Globals; + +struct VertexInput { + [[location(0)]] position: vec2<f32>; + [[location(1)]] color: vec4<f32>; +}; + +struct VertexOutput { + [[builtin(position)]] position: vec4<f32>; + [[location(0)]] color: vec4<f32>; +}; + +[[stage(vertex)]] +fn vs_main(input: VertexInput) -> VertexOutput { + var out: VertexOutput; + + out.color = input.color; + out.position = globals.transform * vec4<f32>(input.position, 0.0, 1.0); + + return out; +} + +[[stage(fragment)]] +fn fs_main(input: VertexOutput) -> [[location(0)]] vec4<f32> { + return input.color; +} |