diff options
author | 2021-05-24 20:26:56 +0700 | |
---|---|---|
committer | 2021-05-24 20:26:56 +0700 | |
commit | df971ac99beedb41537763f95f7b14d8bf7475a8 (patch) | |
tree | 70bf9d7aac84ae05f841b51dca6eb66c1769de93 /wgpu/src/shader/triangle.wgsl | |
parent | 3918257883dba3cf260bd9764cb7b34101c435e6 (diff) | |
parent | 4cbc34524598756ce18cb25a664bc6f256d42851 (diff) | |
download | iced-df971ac99beedb41537763f95f7b14d8bf7475a8.tar.gz iced-df971ac99beedb41537763f95f7b14d8bf7475a8.tar.bz2 iced-df971ac99beedb41537763f95f7b14d8bf7475a8.zip |
Merge pull request #830 from Dispersia/upgrade-wgpu
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; +} |