blob: 9c8e9f19c24310948325ec55b9901e1a4c1324f2 (
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
|
// Test if generic arguments using arithmetics are folded properly.
//TEST:SIMPLE(filecheck=HLSL): -stage compute -entry computeMain -target hlsl
RWStructuredBuffer<float> outputBuffer;
__generic<let ArraySize:int>
struct MyStruct
{
int elems[ArraySize];
};
__generic<let ArraySize:int>
MyStruct<ArraySize / 2> Reduce(MyStruct<ArraySize> o)
{
MyStruct<ArraySize / 2> result;
//HLSL:[[ReturnType:MyStruct_[0-9]*]] Reduce
//HLSL:[[ReturnType]] result
result.elems[0] = o.elems[0];
// Error happened here as the return type differs
// from the type of "result".
return result;
}
[numthreads(1, 1, 1)]
void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
{
MyStruct<4> a;
a.elems[0] = 2;
let result = Reduce(a);
outputBuffer[0] = result.elems[0];
}
|