summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/generics-simple.slang26
-rw-r--r--tests/compute/generics-simple.slang.expected.txt4
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/compute/generics-simple.slang b/tests/compute/generics-simple.slang
new file mode 100644
index 000000000..0002e444b
--- /dev/null
+++ b/tests/compute/generics-simple.slang
@@ -0,0 +1,26 @@
+//TEST(smoke,compute):COMPARE_COMPUTE:-xslang -use-ir
+
+// Confirm that generics syntax can be used in user
+// code and generates valid output.
+
+RWStructuredBuffer<float> outputBuffer;
+
+
+__generic<T>
+T test(T val)
+{
+ return val;
+}
+
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ float inVal = float(tid);
+
+ float outVal = test<float>(inVal);
+
+ outputBuffer[tid] = outVal;
+} \ No newline at end of file
diff --git a/tests/compute/generics-simple.slang.expected.txt b/tests/compute/generics-simple.slang.expected.txt
new file mode 100644
index 000000000..fdaa30664
--- /dev/null
+++ b/tests/compute/generics-simple.slang.expected.txt
@@ -0,0 +1,4 @@
+0.0
+1.0
+2.0
+3.0 \ No newline at end of file