forked from shader-slang/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtype-legalize-bug-1.slang
57 lines (52 loc) · 1.05 KB
/
type-legalize-bug-1.slang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//TEST(compute):COMPARE_COMPUTE: -shaderobj
//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl
//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;
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();
}