blob: 4ee50b88d46b76929e5d6fa7e81b98d46dc02c06 (
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
|
//TEST(compute):COMPARE_COMPUTE: -shaderobj -output-using-type
//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj -output-using-type
// This test confirms that we can provide a subset of the required generic
// arguments to a generic function, and have the rest be inferred from the
// types of the value arguments.
interface IConvertible
{
__init( int value );
property value : int { get; }
}
ToType convert< ToType : IConvertible, FromType : IConvertible >( FromType fromVal )
{
return ToType( fromVal.value*0x10 );
}
struct A : IConvertible
{
int value;
__init(int v) { this.value = v; }
}
struct B : IConvertible
{
int value;
__init(int v) { this.value = v; }
}
int test( int value )
{
A a = A(value);
B b = convert<B>(a);
return a.value + b.value;
}
//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] = test(tid);
}
|