summaryrefslogtreecommitdiff
path: root/examples/wgpu-html5/shader.slang
diff options
context:
space:
mode:
authorAnders Leino <aleino@nvidia.com>2024-12-30 11:42:25 +0200
committerGitHub <noreply@github.com>2024-12-30 11:42:25 +0200
commit89dd2b1278f9e457d9d343742a51de27502ebca1 (patch)
tree22899e27c4131d86f395d2c501d92a694eb6a137 /examples/wgpu-html5/shader.slang
parentb2d51adc4b433c44298d35bb19637496c99ce44b (diff)
Add a basic WebGPU example (#5923)
* Add a basic WebGPU example This helps to address #5656. * Use serial await rather than Promise.all
Diffstat (limited to 'examples/wgpu-html5/shader.slang')
-rw-r--r--examples/wgpu-html5/shader.slang28
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/wgpu-html5/shader.slang b/examples/wgpu-html5/shader.slang
new file mode 100644
index 000000000..0721a1fff
--- /dev/null
+++ b/examples/wgpu-html5/shader.slang
@@ -0,0 +1,28 @@
+struct VertexStageInput
+{
+ float4 position : POSITION0;
+};
+
+struct VertexStageOutput
+{
+ float4 positionClipSpace : SV_POSITION;
+};
+
+struct FragmentStageOutput
+{
+ float4 color : SV_TARGET;
+};
+
+VertexStageOutput vertexMain(VertexStageInput input) : SV_Position
+{
+ VertexStageOutput output;
+ output.positionClipSpace = float4(input.position.xy, 1);
+ return output;
+}
+
+FragmentStageOutput fragmentMain() : SV_Target
+{
+ FragmentStageOutput output;
+ output.color = float4(0, 1, 0, 1);
+ return output;
+}