summaryrefslogtreecommitdiffstats
path: root/tests/compute/nested-generics2.slang
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compute/nested-generics2.slang')
-rw-r--r--tests/compute/nested-generics2.slang43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/compute/nested-generics2.slang b/tests/compute/nested-generics2.slang
new file mode 100644
index 000000000..6a14c7678
--- /dev/null
+++ b/tests/compute/nested-generics2.slang
@@ -0,0 +1,43 @@
+//TEST(compute):COMPARE_COMPUTE:-xslang -use-ir
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+
+// test specialization of nested generic functions
+
+RWStructuredBuffer<int> outputBuffer;
+
+interface IBRDF
+{
+ float getF();
+}
+
+interface ILight
+{
+ float illum<B:IBRDF>(B b);
+};
+
+struct B0 : IBRDF
+{
+ float getF() { return 1.0; }
+};
+
+struct L0 : ILight
+{
+ float illum<B:IBRDF>(B b) { return b.getF(); }
+};
+
+struct L1<L:ILight> : ILight
+{
+ L l;
+ float illum<BXX:IBRDF>(BXX bxx) { return l.illum<BXX>(bxx); }
+};
+
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+ L1<L0> light;
+ B0 b0;
+ float outVal = light.illum<B0>(b0);
+ outputBuffer[tid] = int(outVal);
+} \ No newline at end of file