From 4b284daeb0cc3f6df0835befad4326c81abeb374 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 9 Jan 2018 13:26:42 -0800 Subject: Support nested generics fixes #362 --- tests/compute/nested-generics2.slang | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/compute/nested-generics2.slang (limited to 'tests/compute/nested-generics2.slang') 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 outputBuffer; + +interface IBRDF +{ + float getF(); +} + +interface ILight +{ + float illum(B b); +}; + +struct B0 : IBRDF +{ + float getF() { return 1.0; } +}; + +struct L0 : ILight +{ + float illum(B b) { return b.getF(); } +}; + +struct L1 : ILight +{ + L l; + float illum(BXX bxx) { return l.illum(bxx); } +}; + + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + uint tid = dispatchThreadID.x; + L1 light; + B0 b0; + float outVal = light.illum(b0); + outputBuffer[tid] = int(outVal); +} \ No newline at end of file -- cgit v1.2.3