blob: 1be4e59fc85270e05ccbbe3839b6aa77e6aa181f (
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
|
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
/* Test here is to try and associate a value with a type
Lets see if we can do something with a built in type
Doesn't work because
error 30052: invalid swizzle pattern 'getType' on type 'int'
let type = i.getType();
*/
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;
enum class Type
{
Unknown,
Float,
Int,
};
interface IHasType
{
Type getType()
};
extension int : IHasType
{
Type getType() { return Type::Int; }
};
extension float : IHasType
{
Type getType() { return Type::Float; }
};
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
int index = dispatchThreadID.x;
int i;
let type = i.getType();
outputBuffer[dispatchThreadID.x] = int(type);
}
|