blob: e03bb4e54882e4d4c19676508680514c0d527794 (
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(smoke,compute):COMPARE_COMPUTE:-xslang -use-ir
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
// Confirm that generics syntax can be used in user
// code and generates valid output.
RWStructuredBuffer<float> outputBuffer;
interface ISimple
{
associatedtype U;
U add(U v0, U v1);
}
struct Simple : ISimple
{
typedef float U;
U add(U v0, float v1)
{
return v0 + v1;
}
};
__generic<T:ISimple>
T.U test(T simple, T.U v0, T.U v1)
{
return simple.add(v0, v1);
}
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
Simple s;
float outVal = test<Simple>(s, 2.0, 1.0); // == 3.0
outputBuffer[tid] = outVal;
}
|