blob: 730373b7695120cb429a60309289d6f19e9d8c17 (
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
|
//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 we can use `where` clause to constrain the type of a type pack.
interface IFoo
{
associatedtype TA;
}
struct FooImpl : IFoo
{
typealias TA = int;
}
void add(inout int a, int b)
{
a += b;
}
int process<each T>(T v) where T == int
{
int result = 0;
expand add(result, each v);
return result;
}
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<float> outputBuffer;
[numthreads(1,1,1)]
void computeMain()
{
outputBuffer[0] = process(1,2,3);
// CHECK: 6.0
}
|