summaryrefslogtreecommitdiff
path: root/examples/hello-world/hello-world.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-04-16 10:35:42 -0700
committerGitHub <noreply@github.com>2021-04-16 10:35:42 -0700
commit2886bc35e7b023370a8b8d56d78e5335eee2eb98 (patch)
treeef40d6029f2f024a95602efb921c27383cf887f5 /examples/hello-world/hello-world.slang
parent79e92395f8ce3d92c446e3bb3250d19ce33decd5 (diff)
Add Hello world example. (#1797)
Diffstat (limited to 'examples/hello-world/hello-world.slang')
-rw-r--r--examples/hello-world/hello-world.slang12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/hello-world/hello-world.slang b/examples/hello-world/hello-world.slang
new file mode 100644
index 000000000..565924035
--- /dev/null
+++ b/examples/hello-world/hello-world.slang
@@ -0,0 +1,12 @@
+// hello-world.slang
+StructuredBuffer<float> buffer0;
+StructuredBuffer<float> buffer1;
+RWStructuredBuffer<float> result;
+
+[shader("compute")]
+[numthreads(1,1,1)]
+void computeMain(uint3 threadId : SV_DispatchThreadID)
+{
+ uint index = threadId.x;
+ result[index] = buffer0[index] + buffer1[index];
+}