summaryrefslogtreecommitdiffstats
path: root/tests/compute
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/empty-struct2.slang52
-rw-r--r--tests/compute/empty-struct2.slang.expected.txt4
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/compute/empty-struct2.slang b/tests/compute/empty-struct2.slang
new file mode 100644
index 000000000..17cbb6ab4
--- /dev/null
+++ b/tests/compute/empty-struct2.slang
@@ -0,0 +1,52 @@
+//TEST(smoke,compute):COMPARE_COMPUTE:
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
+// This is a basic test for Slang compute shader.
+
+RWStructuredBuffer<uint> outputBuffer;
+
+interface IInterface
+{
+ associatedtype T;
+ T getT();
+ [mutating]
+ void setT(T val);
+}
+interface IEmptyS
+{
+ float emptyFunc();
+};
+struct EmptyS : IEmptyS
+{
+ float emptyFunc() {return 0.0;}
+};
+
+struct Empty<TT : IEmptyS> : IInterface
+{
+ typedef TT T;
+ TT value;
+ float a;
+ TT getT()
+ {
+ return value;
+ }
+ [mutating]
+ void setT(TT val)
+ {
+ value = val;
+ a = value.emptyFunc();
+ }
+}
+
+void test<Obj : IInterface>(Obj obj)
+{
+ Obj.T v = obj.getT();
+ obj.setT(v);
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ Empty<EmptyS> obj;
+ test(obj);
+ outputBuffer[dispatchThreadID.x] = dispatchThreadID.x;
+} \ No newline at end of file
diff --git a/tests/compute/empty-struct2.slang.expected.txt b/tests/compute/empty-struct2.slang.expected.txt
new file mode 100644
index 000000000..e8c63f701
--- /dev/null
+++ b/tests/compute/empty-struct2.slang.expected.txt
@@ -0,0 +1,4 @@
+0
+1
+2
+3 \ No newline at end of file