yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeFixup address spaces after inlining. (#7731)1e1a49ccf

master
676 B48 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -O0
2
3//CHECK: OpEntryPoint
4
5struct Result
6{
7    float3 value;
8};
9
10struct Indirect
11{
12    float scale;
13};
14
15struct PushConstant
16{
17    Indirect *ptr;
18};
19
20struct Payload
21{
22    uint seed;
23};
24
25ConstantBuffer<PushConstant> pushConstants;
26
27Result f3(Indirect ss, float2 randomSample)
28{
29    Result result;
30    result.value = randomSample.x;
31    return result;
32}
33
34float3 f2(inout uint seed)
35{
36    return f3(*pushConstants.ptr, float2(seed)).value;
37}
38
39float3 f1(inout Payload payload)
40{
41    return f2(payload.seed);
42}
43
44[shader("closesthit")]
45void main(inout Payload payload, in BuiltInTriangleIntersectionAttributes attr)
46{
47    f1(payload);
48}