diff options
Diffstat (limited to 'tests/compute/globalTypeParamArrayShared.slang')
| -rw-r--r-- | tests/compute/globalTypeParamArrayShared.slang | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/compute/globalTypeParamArrayShared.slang b/tests/compute/globalTypeParamArrayShared.slang new file mode 100644 index 000000000..65d09f14e --- /dev/null +++ b/tests/compute/globalTypeParamArrayShared.slang @@ -0,0 +1,31 @@ +interface IBase +{ + float compute<T>(T g); +} +struct Base:IBase +{ + float b; + float compute<T>(T g) { return b; } +}; + +struct Pair<T1:IBase, T2:IBase> : IBase +{ + T1 head; + T2 tail; + float compute<T>(T g) + { + return head.compute(g) + tail.compute(g); + } +}; + +struct Arr<T:IBase, let N:int> : IBase +{ + T base[N]; // = 1.0 + float compute<T>(T g) + { + float sum = 0.0; + for (int i = 0; i < N; i++) + sum += base[i].compute(g); + return sum; + } +}; |
