blob: 61e1c13869b77f4f3092bd8f6016586f9e2158a1 (
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
|
// Test that multiple functions from different extensions are properly linked through their respective witness table.
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj
interface IValuableImpl
{
int getValue();
}
interface IValuable
{
associatedtype Impl : IValuableImpl;
Impl getImpl();
};
__generic <Int : __BuiltinIntegerType>
extension Int : IValuableImpl
{
int getValue()
{
return 0;
}
};
__generic <Float : __BuiltinFloatingPointType>
extension Float : IValuableImpl
{
int getValue()
{
return 1;
}
};
__generic <ValuableImpl : IValuableImpl>
extension ValuableImpl : IValuable
{
typealias Impl = ValuableImpl;
ValuableImpl getImpl()
{
return this;
}
};
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;
[shader("compute")]
[numthreads(1, 1, 1)]
void computeMain()
{
uint i = 0;
float f = float(i) / float(10);
// CHECK: 0
outputBuffer[0] = i.getImpl().getValue();
// CHECK: 1
outputBuffer[1] = f.getImpl().getValue();
}
|