blob: b68dc8a4c2936a9d7d3dee30325d10f90c5650fa (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
//TEST:SIMPLE(filecheck=CHECK): -target hlsl -entry testMain -profile cs_6_0
// Test that invoking the default constructor of a type then use the result as an existential value
// works correctly.
RWStructuredBuffer<uint> output;
RWStructuredBuffer<uint> expected;
interface ITest
{
uint getValue();
};
//TEST_INPUT:type_conformance Test0:ITest = 0
struct Test0 : ITest
{
uint getValue() { return 0; }
};
//TEST_INPUT:type_conformance Test1:ITest = 1
struct Test1 : ITest
{
uint getValue() { return 1; }
};
//TEST_INPUT:type_conformance TestAny:ITest = 2
struct TestAny : ITest
{
uint value = 5;
__init(uint v)
{
value = v;
}
__init()
{
value = 0;
}
uint getValue() { return value; }
}
ITest makeTest0()
{
return Test0();
}
ITest makeTest1()
{
return Test1();
}
// CHECK: TestAny{{.*}} makeTestAny{{.*}}()
// CHECK: return TestAny_{{.*}}init{{.*}}()
ITest makeTestAny()
{
return TestAny();
}
ITest makeTestAny(uint v)
{
return TestAny(v);
}
[numthreads(16, 1, 1)]
void testMain(uint3 threadID: SV_DispatchThreadID)
{
if (threadID.x != 0)
return;
int outputIdx = 0;
/// Test0
{
Test0 test;
output[outputIdx] = test.getValue();
expected[outputIdx++] = 0;
}
{
ITest test = Test0();
output[outputIdx] = test.getValue();
expected[outputIdx++] = 0;
}
{
output[outputIdx] = Test0().getValue();
expected[outputIdx++] = 0;
}
{
ITest test = makeTest0();
output[outputIdx] = test.getValue();
expected[outputIdx++] = 0;
}
{
output[outputIdx] = makeTest0().getValue();
expected[outputIdx++] = 0;
}
output[outputIdx] = 1000;
expected[outputIdx++] = 1000;
/// Test1
{
Test1 test;
output[outputIdx] = test.getValue();
expected[outputIdx++] = 1;
}
{
ITest test = Test1();
output[outputIdx] = test.getValue();
expected[outputIdx++] = 1;
}
{
output[outputIdx] = Test1().getValue();
expected[outputIdx++] = 1;
}
{
ITest test = makeTest1();
output[outputIdx] = test.getValue();
expected[outputIdx++] = 1;
}
{
output[outputIdx] = makeTest1().getValue();
expected[outputIdx++] = 1;
}
output[outputIdx] = 2000;
expected[outputIdx++] = 2000;
/// TestAny
{
TestAny test;
output[outputIdx] = test.getValue();
expected[outputIdx++] = 5;
}
{
ITest test = TestAny();
output[outputIdx] = test.getValue();
expected[outputIdx++] = 5;
}
{
ITest test = TestAny(2);
output[outputIdx] = test.getValue();
expected[outputIdx++] = 2;
}
{
output[outputIdx] = TestAny().getValue();
expected[outputIdx++] = 5;
}
{
output[outputIdx] = TestAny(2).getValue();
expected[outputIdx++] = 2;
}
{
ITest test = makeTestAny();
output[outputIdx] = test.getValue();
expected[outputIdx++] = 5;
}
{
ITest test = makeTestAny(2);
output[outputIdx] = test.getValue();
expected[outputIdx++] = 2;
}
{
output[outputIdx] = makeTestAny().getValue();
expected[outputIdx++] = 5;
}
{
output[outputIdx] = makeTestAny(2).getValue();
expected[outputIdx++] = 2;
}
expected[outputIdx++] = uint(-1);
}
|