blob: d2f1af47fa8f2606d92ce7fdf2b858c83d68318d (
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: -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj -output-using-type
T simpleTest<T : IArithmetic>(T v0, T v1)
{
if (v0 > T(0))
{
return v0 + v1;
}
else
{
return -v0 * v1;
}
}
interface IMyInterface : IArithmetic
{
int myMethod();
}
extension float : IMyInterface
{
int myMethod() { return 4; }
}
extension double : IMyInterface
{
int myMethod() { return 8; }
}
int genTest<T : IMyInterface>(T v0, T v1)
{
vector<T, 2> v = vector<T, 2>(v0, v1);
return (v.x + v.y).myMethod();
}
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;
[numthreads(4, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
int tid = dispatchThreadID.x;
outputBuffer[tid] = int(simpleTest<float>(1.0f, 2.0f)) + genTest<float>(1.0f, 2.0f);
}
|