blob: 6b9aa1b019ae3781e17daac126673703da9ebbb0 (
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
|
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -output-using-type
// Test that an associated type can be constrained to a generic interface.
interface IB<let DIM : int>
{
int bar();
}
interface IA<let DIM : int>
{
associatedtype B : IB<DIM>;
B getB();
}
struct BImpl<int x> : IB<x>
{
int bar() { return x; }
}
struct AImpl<int y> : IA<y>
{
typealias B = BImpl<y>;
B getB() { BImpl<y> b = {}; return b; }
}
int test<int z, T : IA<z>>(T t)
{
T.B bb = t.getB();
return bb.bar();
}
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;
[numthreads(1,1,1)]
void computeMain()
{
AImpl<5> a;
// CHECK: 5
outputBuffer[0] = test(a);
}
|