summaryrefslogtreecommitdiff
path: root/cli/tests/webgpu_hellotriangle_shader.wgsl
diff options
context:
space:
mode:
authorcrowlKats <13135287+crowlKats@users.noreply.github.com>2021-03-01 11:31:13 +0100
committerGitHub <noreply@github.com>2021-03-01 11:31:13 +0100
commit7cd14f97c9300357475e3e461fa57cbb7ec5bfec (patch)
tree39eb11e8a9c53001ffe814f5aac3ec5e37de6357 /cli/tests/webgpu_hellotriangle_shader.wgsl
parentdbdbe7a1cf0d56df85305eb3638bc177d8a0216f (diff)
feat: WebGPU API (#7977)
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Diffstat (limited to 'cli/tests/webgpu_hellotriangle_shader.wgsl')
-rw-r--r--cli/tests/webgpu_hellotriangle_shader.wgsl19
1 files changed, 19 insertions, 0 deletions
diff --git a/cli/tests/webgpu_hellotriangle_shader.wgsl b/cli/tests/webgpu_hellotriangle_shader.wgsl
new file mode 100644
index 000000000..71934415b
--- /dev/null
+++ b/cli/tests/webgpu_hellotriangle_shader.wgsl
@@ -0,0 +1,19 @@
+[[builtin(vertex_index)]]
+var<in> in_vertex_index: u32;
+[[builtin(position)]]
+var<out> out_pos: vec4<f32>;
+
+[[stage(vertex)]]
+fn vs_main() {
+ var x: f32 = f32(i32(in_vertex_index) - 1);
+ var y: f32 = f32(i32(in_vertex_index & 1) * 2 - 1);
+ out_pos = vec4<f32>(x, y, 0.0, 1.0);
+}
+
+[[location(0)]]
+var<out> out_color: vec4<f32>;
+
+[[stage(fragment)]]
+fn fs_main() {
+ out_color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
+}