blob: 2b88e7611ed2f5679832b8191ab5b6419d71b5ad (
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
54
55
56
57
58
|
//TEST:SIMPLE(filecheck=CHECK_DXIL): -target dxil -profile sm_6_0 -entry computeMain -stage compute -DMEMBER_FUNCTION_CALL
//TEST:SIMPLE(filecheck=CHECK_DXIL): -target dxil -profile sm_6_0 -entry computeMain -stage compute
//CHECK_DXIL: computeMain
struct Grid
{
uint bufSize;
StructuredBuffer<uint> buf;
};
struct GridGeo
{
Grid grids[2];
void getGrid(uint index, out Grid grid)
{
grid = grids[index];
}
};
struct Scene
{
GridGeo gridGeo;
void getGrid_BAD(uint index, out Grid grid)
{
gridGeo.getGrid(index, grid);
}
void getGrid_GOOD(uint index, out Grid grid)
{
grid = gridGeo.grids[index];
}
};
ParameterBlock<Scene> gScene;
RWStructuredBuffer<uint> gridBuffers[2];
RWStructuredBuffer<uint> outputBuffer;
void direct_getGrid_BAD(uint index, out Grid grid)
{
gScene.gridGeo.getGrid(index, grid);
}
[numthreads(1, 1, 1)]
void computeMain(uint3 threadId: SV_DispatchThreadID)
{
Grid grid;
#ifdef MEMBER_FUNCTION_CALL
direct_getGrid_BAD(1, grid);
#else
gScene.getGrid_BAD(1, grid);
#endif
gridBuffers[0][1] = grid.buf[1];
}
|