From d33e6b7475a87d5a62101afc81813e9c9e458a70 Mon Sep 17 00:00:00 2001 From: Yong He Date: Sun, 14 Jan 2018 16:22:11 -0500 Subject: allow extension of a concrete type to implement additional interface Also support the scenario that the extension declares conformance to interface I, and a method M in I is already supported by the base implementation. --- tests/compute/multi-interface.slang | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/compute/multi-interface.slang (limited to 'tests/compute/multi-interface.slang') diff --git a/tests/compute/multi-interface.slang b/tests/compute/multi-interface.slang new file mode 100644 index 000000000..1f9775211 --- /dev/null +++ b/tests/compute/multi-interface.slang @@ -0,0 +1,45 @@ +//TEST(compute):COMPARE_COMPUTE:-xslang -use-ir +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out + +RWStructuredBuffer outputBuffer; + +interface IAdd +{ + float addf(float u, float v); +} + +interface ISub +{ + float subf(float u, float v); +} + +interface IAddAndSub +{ + float addf(float u, float v); + float subf(float u, float v); +} + +struct Simple : IAdd, ISub, IAddAndSub +{ + float addf(float u, float v) + { + return u+v; + } + float subf(float u, float v) + { + return u-v; + } +}; + +float testAddSub(T t) +{ + return t.subf(t.addf(1.0, 1.0), 1.0); +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + Simple s; + float outVal = testAddSub(s); + outputBuffer[dispatchThreadID.x] = outVal; +} \ No newline at end of file -- cgit v1.2.3