summaryrefslogtreecommitdiff
path: root/tests/language-feature/generics/variadic-void.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/language-feature/generics/variadic-void.slang')
-rw-r--r--tests/language-feature/generics/variadic-void.slang44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/language-feature/generics/variadic-void.slang b/tests/language-feature/generics/variadic-void.slang
new file mode 100644
index 000000000..d44acbfd4
--- /dev/null
+++ b/tests/language-feature/generics/variadic-void.slang
@@ -0,0 +1,44 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+struct S<T>
+{
+ T v;
+ __init(T x)
+ {
+ v = x;
+ }
+}
+
+
+S<T> makeS<T>(T x)
+{
+ return S<T>(x);
+}
+
+void accept<each T>(expand each T value) {}
+
+void writeSingle<T : __BuiltinFloatingPointType>(T value)
+{
+ static int counter = 0;
+ outputBuffer[counter++] = __realCast<float>(value);
+ //return value;
+}
+
+void write<each T : __BuiltinFloatingPointType>(expand S<each T> value)
+{
+ accept(expand writeSingle((each value).v));
+}
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ // CHECK: 1.0
+ // CHECK: 2.0
+ // CHECK: 3.0
+ // CHECK: 4.0
+ write(makeS(1.0), makeS(2.0), makeS(3.0), makeS(4.0));
+ write();
+} \ No newline at end of file