summaryrefslogtreecommitdiffstats
path: root/tests/optimization/buffer-load-defer-ptr.slang
blob: cde006dcfb1253d36707df35eaace79ba05f949e (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
//TEST:SIMPLE(filecheck=SPV): -target spirv

struct Bottom
{
    float bigArray[1024];
    float bottomGetValue(int index) { return bigArray[index]; }
}

struct Middle
{
    Bottom bottom;
    float middleGetValue(int index) { return bottom.bottomGetValue(index); }
}

struct Top
{
    Middle middle;
    float topGetValue(int index) { return middle.middleGetValue(index); }
}

struct Root
{
    Top top;
}

uniform ImmutablePtr<Root> cb;

RWStructuredBuffer<float> outputBuffer;

// SPV: OpEntryPoint
// SPV-NOT: OpCompositeConstruct

[shader("compute")]
[numthreads(1, 1, 1)]
void compute_main(uint3 tid: SV_DispatchThreadID)
{
    outputBuffer[0] = cb.top.topGetValue(0);
}