blob: 986fffaf7e7a3dfc56a48441f814a42d393c1f74 (
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
|
//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
/* Test here is to try and associate a value with a type
This doesn't work - it produces dynamic dispatch code, that is uncompilable because cases
are missing.
.slang(24): error : control reaches end of non-void function [-Wreturn-type]
dxc: note : }
dxc: note : ^
*/
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
RWStructuredBuffer<int> outputBuffer;
enum class Enum
{
A, B
};
interface IGetE
{
static Enum getE();
};
struct A : IGetE
{
static Enum getE() { return Enum::A; }
};
struct B : IGetE
{
static Enum getE() { return Enum::B; }
};
[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
int index = dispatchThreadID.x;
// Err.. even though IGetE doesn't require an instanciation, not clear how to set it. So lets try with instanciation
B b;
IGetE g = b;
let e = g.getE();
outputBuffer[dispatchThreadID.x] = int(e);
}
|