blob: 2322abb1a2be4953478453290789b561567eef8d (
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
50
51
52
53
|
//TEST:SIMPLE(filecheck=CHECK): -target glsl -stage compute -entry computeMain
//TEST:SIMPLE(filecheck=CHECK): -target hlsl -stage compute -entry computeMain
//TEST:SIMPLE(filecheck=CHECK): -target cuda -stage compute -entry computeMain
//TEST:SIMPLE(filecheck=CHECK): -target cpp -stage compute -entry computeMain
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int> outputBuffer;
interface IFoo
{
int foo(int a);
}
struct MyImpl : IFoo
{
int foo(int a) { return a; }
}
struct MyImpl1 : IFoo
{
int foo(int a) { return a; }
}
int test(IFoo foo, int idx)
{
int val = 0;
if (let a = foo as MyImpl)
{
val = a.foo(idx);
}
// CHECK: error 30015: undefined identifier 'a'.
else if(a == none)
{
val = -1;
}
else
{
// CHECK: error 30015: undefined identifier 'a'.
if (a == none)
{
val = -1;
}
}
return (val);
}
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
{
MyImpl1 impl;
outputBuffer[dispatchThreadID.x] = test(impl, dispatchThreadID.x);
}
|