summaryrefslogtreecommitdiff
path: root/examples/cpu-hello-world/shader.slang
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-09-23 17:42:14 -0400
committerGitHub <noreply@github.com>2019-09-23 17:42:14 -0400
commitdc76577e2f1d851d6eb4963fa24d310d847b6786 (patch)
treee762a2fc22b36d585456e8345f2562cdcbea5fdc /examples/cpu-hello-world/shader.slang
parente9f0544aa4737d5cba8424f95485811b4839d76e (diff)
CPU Hello World (#1065)
* First pass on cpu-hello-world application. * Improvements to cpu-hello-world * Improved documentation around cpu-hello-world. Added information about C++/CPU targets to README.md Referenced cpu-target.
Diffstat (limited to 'examples/cpu-hello-world/shader.slang')
-rw-r--r--examples/cpu-hello-world/shader.slang15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/cpu-hello-world/shader.slang b/examples/cpu-hello-world/shader.slang
new file mode 100644
index 000000000..bac5832a8
--- /dev/null
+++ b/examples/cpu-hello-world/shader.slang
@@ -0,0 +1,15 @@
+// shader.slang
+
+//TEST_INPUT:ubuffer(random(float, 4096, -1.0, 1.0), stride=4):dxbinding(0),glbinding(0),name=ioBuffer
+RWStructuredBuffer<float> ioBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ float i = ioBuffer[tid];
+ float o = i < 0.5 ? (i + i) : sqrt(i);
+
+ ioBuffer[tid] = o;
+}