diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bugs/type-legalize-bug-1.slang | 56 | ||||
| -rw-r--r-- | tests/bugs/type-legalize-bug-1.slang.expected.txt | 4 |
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/bugs/type-legalize-bug-1.slang b/tests/bugs/type-legalize-bug-1.slang new file mode 100644 index 000000000..83e28a509 --- /dev/null +++ b/tests/bugs/type-legalize-bug-1.slang @@ -0,0 +1,56 @@ +//TEST(compute):COMPARE_COMPUTE: -shaderobj + +//TEST_INPUT:ubuffer(data=[9 9 9 9], stride=4):out,name outputBuffer +//TEST_INPUT:type_conformance A:IFoo=0 +//TEST_INPUT:type_conformance B:IFoo=1 + +RWStructuredBuffer<int> outputBuffer : register(u0); +interface IFoo +{ + associatedtype T : IFoo; + T getT(); + void doSomething(); +} + +A createA() { return {}; } +B createB() { return {}; } +ParameterBlock<B> gB; +void user() +{ + IFoo a = createDynamicObject<IFoo>(0, 0); + IFoo b = createDynamicObject<IFoo>(1, 0); + test(a.getT(), b); + test(a, gB.getT()); +} +B test<T:IFoo>(T a, IFoo b) +{ + a.doSomething(); + b.doSomething(); + return {}; +} +struct B :IFoo +{ + A a; + typealias T = A; + T getT() { return {};} + void doSomething() + { + outputBuffer[0] = 1; + } +} +struct A : IFoo +{ + typealias T = B; + T getT() { return {};} + void doSomething() + { + outputBuffer[0] = 1; + } +} + + +[numthreads(4, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + user(); +}
\ No newline at end of file diff --git a/tests/bugs/type-legalize-bug-1.slang.expected.txt b/tests/bugs/type-legalize-bug-1.slang.expected.txt new file mode 100644 index 000000000..89999d47a --- /dev/null +++ b/tests/bugs/type-legalize-bug-1.slang.expected.txt @@ -0,0 +1,4 @@ +1 +9 +9 +9 |
