summaryrefslogtreecommitdiffstats
path: root/tests/spirv/pointer-access.slang
blob: 2816136403d11fbfccda253b6175954c3884d5bf (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
//TEST:SIMPLE(filecheck=CHECK): -target spirv -O0

//CHECK: OpEntryPoint

struct Result
{
    float3 value;
};

struct Indirect
{
    float scale;
};

struct PushConstant
{
    Indirect *ptr;
};

struct Payload
{
    uint seed;
};

ConstantBuffer<PushConstant> pushConstants;

Result f3(Indirect ss, float2 randomSample)
{
    Result result;
    result.value = randomSample.x;
    return result;
}

float3 f2(inout uint seed)
{
    return f3(*pushConstants.ptr, float2(seed)).value;
}

float3 f1(inout Payload payload)
{
    return f2(payload.seed);
}

[shader("closesthit")]
void main(inout Payload payload, in BuiltInTriangleIntersectionAttributes attr)
{
    f1(payload);
}