diff options
| author | Yong He <yonghe@outlook.com> | 2024-08-18 21:57:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-18 21:57:24 -0700 |
| commit | ecf85df6eee3da76ef54b14e4ab083f22da89e46 (patch) | |
| tree | 4656f9c11a1f7f40550d469fecbcd7a16c541f52 /tests/language-feature/generics/variadic-void.slang | |
| parent | ca5d303748517889a5d5849224671fa8945e1c6d (diff) | |
Variadic Generics Part 2: IR lowering and specialization. (#4849)
* Variadic Generics Part 2: IR lowering and specialization.
* Update design doc status.
* Update design doc.
* Resolve review comments.
Diffstat (limited to 'tests/language-feature/generics/variadic-void.slang')
| -rw-r--r-- | tests/language-feature/generics/variadic-void.slang | 44 |
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 |
