From d5e2319c33115d0241dd9d2047c0a5f029553dde Mon Sep 17 00:00:00 2001 From: "YONGH\\yongh" Date: Thu, 2 Nov 2017 19:21:15 -0400 Subject: work inprogress --- tests/compute/assoctype-complex.slang | 59 +++++++++++++++++++++++++++ tests/compute/assoctype-complex.slang._ignore | 44 -------------------- tests/compute/generics-constraint1.slang | 17 ++++++++ 3 files changed, 76 insertions(+), 44 deletions(-) create mode 100644 tests/compute/assoctype-complex.slang delete mode 100644 tests/compute/assoctype-complex.slang._ignore create mode 100644 tests/compute/generics-constraint1.slang (limited to 'tests') diff --git a/tests/compute/assoctype-complex.slang b/tests/compute/assoctype-complex.slang new file mode 100644 index 000000000..de3f1a103 --- /dev/null +++ b/tests/compute/assoctype-complex.slang @@ -0,0 +1,59 @@ +//TEST(smoke, compute):COMPARE_COMPUTE:-xslang -use-ir +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out + +RWStructuredBuffer outputBuffer; +interface IBase +{ + associatedtype V; + V sub(V a0, V a1); +} +interface ISimple +{ + associatedtype U : IBase; + U.V add(U v0, U v1); +} + +struct Val : IBase +{ + typedef int V; + V sub(V a0, V a1) + { + return a0-a1; + } +}; + +struct Simple : ISimple +{ + typedef Val U; + Val.V add(U v0, U v1) + { + return v0.sub(4, v1.sub(1,2)); + } +}; +/* +__generic +T.U.V test(T simple, T.U v0, T.U v1) +{ + return simple.add(v0, v1); +} + +__generic +T test(T v0, T v1) +{ + return v0 + v1; +} +*/ +__generic +T test(T v0, T v1) +{ + return T(3.0); +} +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + //Simple s; + //Val v0, v1; + //float outVal = test(s, v0, v1); // == 1.0 + float outVal = test(1.0, 2.0); + outputBuffer[dispatchThreadID.x] = outVal; +} \ No newline at end of file diff --git a/tests/compute/assoctype-complex.slang._ignore b/tests/compute/assoctype-complex.slang._ignore deleted file mode 100644 index 3e590b2e0..000000000 --- a/tests/compute/assoctype-complex.slang._ignore +++ /dev/null @@ -1,44 +0,0 @@ -RWStructuredBuffer outputBuffer; -interface IBase -{ - associatedtype V; - V sub(V a0, V a1); -} -interface ISimple -{ - associatedtype U : IBase; - U.V add(U v0, U v1); -} - -struct Val : IBase -{ - typedef int V; - V sub(V a0, V a1) - { - return a0-a1; - } -}; - -struct Simple : ISimple -{ - typedef Val U; - Val.V add(U v0, U v1) - { - return v0.sub(4, v1.sub(1,2)); - } -}; - -__generic -T.U.V test(T simple, T.U v0, T.U v1) -{ - return simple.add(v0, v1); -} - -[numthreads(4, 1, 1)] -void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) -{ - Simple s; - Val v0, v1; - float outVal = test(s, v0, v1); // == 1.0 - outputBuffer[0] = outVal; -} \ No newline at end of file diff --git a/tests/compute/generics-constraint1.slang b/tests/compute/generics-constraint1.slang new file mode 100644 index 000000000..ff90c1cc9 --- /dev/null +++ b/tests/compute/generics-constraint1.slang @@ -0,0 +1,17 @@ +//TEST(smoke, compute):COMPARE_COMPUTE:-xslang -use-ir +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out + +RWStructuredBuffer outputBuffer; + +__generic +T test(T v0, T v1) +{ + return T(3.0); +} + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + float outVal = test(1.0, 2.0); + outputBuffer[dispatchThreadID.x] = outVal; +} \ No newline at end of file -- cgit v1.2.3