From dd9d24d29c4a9e05a4510eb9959fafa0ed36618b Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 28 Feb 2025 22:46:56 -0800 Subject: 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. --- .../anyvalue-size-validation.slang.expected | 2 +- .../resource-type-in-dynamic-dispatch.slang | 28 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/diagnostics/resource-type-in-dynamic-dispatch.slang (limited to 'tests/diagnostics') diff --git a/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected b/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected index f2000909b..e94651671 100644 --- a/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected +++ b/tests/diagnostics/interfaces/anyvalue-size-validation.slang.expected @@ -3,7 +3,7 @@ standard error = { tests/diagnostics/interfaces/anyvalue-size-validation.slang(11): error 41011: type 'S' does not fit in the size required by its conforming interface. struct S : IInterface ^ -tests/diagnostics/interfaces/anyvalue-size-validation.slang(11): note 41012: sizeof(S) is 12, limit is 8 +tests/diagnostics/interfaces/anyvalue-size-validation.slang(11): note: sizeof(S) is 12, limit is 8 } standard output = { } 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 outputBuffer; + +[numthreads(1,1,1)] +void computeMain() +{ + IFoo f = createDynamicObject(0, 5); + outputBuffer[0] = f.get(); +} \ No newline at end of file -- cgit v1.2.3