summaryrefslogtreecommitdiff
path: root/tests/diagnostics/resource-type-in-dynamic-dispatch.slang
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-02-28 22:46:56 -0800
committerGitHub <noreply@github.com>2025-02-28 22:46:56 -0800
commitdd9d24d29c4a9e05a4510eb9959fafa0ed36618b (patch)
tree240e2e4ecd8fc15fa835db4377670ec7fdf90e71 /tests/diagnostics/resource-type-in-dynamic-dispatch.slang
parent700c38ae7c16a49de7f720ae3b1940df5b2b4b33 (diff)
Allow partial specialization of existential arguments. (#6487)
* Allow partial specialization of existential arguments. * Fix. * Add test case for improved diagnostics. * Fix compile error. * Fix tests. * Fix. * Fix test. * Fix compile issue. * Fix typo. * Address comment.
Diffstat (limited to 'tests/diagnostics/resource-type-in-dynamic-dispatch.slang')
-rw-r--r--tests/diagnostics/resource-type-in-dynamic-dispatch.slang28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/diagnostics/resource-type-in-dynamic-dispatch.slang b/tests/diagnostics/resource-type-in-dynamic-dispatch.slang
new file mode 100644
index 000000000..114eb800b
--- /dev/null
+++ b/tests/diagnostics/resource-type-in-dynamic-dispatch.slang
@@ -0,0 +1,28 @@
+//TEST:SIMPLE(filecheck=CHECK): -target spirv
+// CHECK: type 'FooImpl' contains fields that cannot be packed into ordinary bytes for dynamic dispatch.
+interface IFoo
+{
+ float get();
+}
+
+export struct FooImpl : IFoo
+{
+ Texture2D t;
+ float get() { return 1.0; }
+}
+
+export struct FooImpl2 : IFoo
+{
+ float v;
+ float get() { return v; }
+}
+
+
+RWStructuredBuffer<float> outputBuffer;
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ IFoo f = createDynamicObject<IFoo>(0, 5);
+ outputBuffer[0] = f.get();
+} \ No newline at end of file