summaryrefslogtreecommitdiff
path: root/tests/compute
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/assoctype-nested-lookup.slang44
-rw-r--r--tests/compute/assoctype-nested-lookup.slang.expected.txt2
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/compute/assoctype-nested-lookup.slang b/tests/compute/assoctype-nested-lookup.slang
new file mode 100644
index 000000000..518e88e25
--- /dev/null
+++ b/tests/compute/assoctype-nested-lookup.slang
@@ -0,0 +1,44 @@
+
+
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+interface IFoo
+{
+ associatedtype Bar : IFoo;
+};
+
+
+struct FooPair<T : IFoo> : IFoo
+{
+ T a;
+ T.Bar b;
+
+ typealias Bar = FooPair<T.Bar>;
+};
+
+
+struct ConcreteFoo : IFoo
+{
+ typealias Bar = ConcreteFoo;
+
+ float x;
+};
+
+void test(FooPair<ConcreteFoo>.Bar pair)
+{
+ pair.a.x = 1.0;
+ pair.b.x = 2.0;
+
+ outputBuffer[0] = pair.a.x + pair.b.x;
+}
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
+{
+ FooPair<ConcreteFoo>.Bar pair;
+ test(pair);
+} \ No newline at end of file
diff --git a/tests/compute/assoctype-nested-lookup.slang.expected.txt b/tests/compute/assoctype-nested-lookup.slang.expected.txt
new file mode 100644
index 000000000..a6122d7ce
--- /dev/null
+++ b/tests/compute/assoctype-nested-lookup.slang.expected.txt
@@ -0,0 +1,2 @@
+type: float
+3.000000