From 89dd2b1278f9e457d9d343742a51de27502ebca1 Mon Sep 17 00:00:00 2001 From: Anders Leino Date: Mon, 30 Dec 2024 11:42:25 +0200 Subject: Add a basic WebGPU example (#5923) * Add a basic WebGPU example This helps to address #5656. * Use serial await rather than Promise.all --- examples/wgpu-html5/shader.slang | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/wgpu-html5/shader.slang (limited to 'examples/wgpu-html5/shader.slang') 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; +} -- cgit v1.2.3