blob: fb32b20013f35408d5bd92fd29b46496965f5e85 (
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
|
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -shaderobj -output-using-type
// Test that a generic interface method in a generic interface
// can have a body providing default implementation.
interface IFoo<int v>
{
int getVal();
int getGreaterVal<int x>()
{
return getVal() + x + v;
}
}
struct Impl : IFoo<2>
{
int getVal()
{
return 42;
}
// Using the default implementation for getGreaterVal.
}
struct Impl2 : IFoo<2>
{
int getVal()
{
return 42;
}
// overriding default implementation.
int getGreaterVal<int x>()
{
return 100 + x;
}
}
int test<int y, T:IFoo<y>>(T v) { return v.getGreaterVal<1>(); }
//TEST_INPUT: set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4)
RWStructuredBuffer<int> resultBuffer;
[numthreads(1,1,1)]
void computeMain()
{
Impl impl = {};
int result = test(impl);
resultBuffer[0] = result;
// CHECK: 45
Impl2 impl2 = {};
resultBuffer[1] = test(impl2);
// CHECK: 101
}
|