summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-11-03 09:38:02 -0400
committerYong He <yonghe@outlook.com>2017-11-03 09:38:02 -0400
commita0458266d7cd5d802b8c51e6a997b4bf0d9beb82 (patch)
tree39f16538178907240e59b8e531ae153391805833 /tests
parentd5e2319c33115d0241dd9d2047c0a5f029553dde (diff)
in-progress work
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/assoctype-complex.slang20
-rw-r--r--tests/compute/generics-constraint1.slang2
-rw-r--r--tests/compute/generics-constructor.slang17
3 files changed, 22 insertions, 17 deletions
diff --git a/tests/compute/assoctype-complex.slang b/tests/compute/assoctype-complex.slang
index de3f1a103..f29d231b6 100644
--- a/tests/compute/assoctype-complex.slang
+++ b/tests/compute/assoctype-complex.slang
@@ -30,30 +30,18 @@ struct Simple : ISimple
return v0.sub(4, v1.sub(1,2));
}
};
-/*
+
__generic<T:ISimple>
T.U.V test(T simple, T.U v0, T.U v1)
{
return simple.add(v0, v1);
}
-__generic<T:__BuiltinArithmeticType>
-T test(T v0, T v1)
-{
- return v0 + v1;
-}
-*/
-__generic<T:__BuiltinFloatingPointType>
-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<float>(1.0, 2.0);
+ Simple s;
+ Val v0, v1;
+ float outVal = test(s, v0, v1); // == 1.0
outputBuffer[dispatchThreadID.x] = outVal;
} \ No newline at end of file
diff --git a/tests/compute/generics-constraint1.slang b/tests/compute/generics-constraint1.slang
index ff90c1cc9..aa8d398e8 100644
--- a/tests/compute/generics-constraint1.slang
+++ b/tests/compute/generics-constraint1.slang
@@ -6,7 +6,7 @@ RWStructuredBuffer<float> outputBuffer;
__generic<T:__BuiltinFloatingPointType>
T test(T v0, T v1)
{
- return T(3.0);
+ return v0;
}
[numthreads(4, 1, 1)]
diff --git a/tests/compute/generics-constructor.slang b/tests/compute/generics-constructor.slang
new file mode 100644
index 000000000..c7473cc8b
--- /dev/null
+++ b/tests/compute/generics-constructor.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<float> outputBuffer;
+
+__generic<T:__BuiltinFloatingPointType>
+T test(T v0, T v1)
+{
+ return T(3.0);
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ float outVal = test<float>(1.0, 2.0);
+ outputBuffer[dispatchThreadID.x] = outVal;
+} \ No newline at end of file