summaryrefslogtreecommitdiffstats
path: root/tests/spirv/explicit-context-validation-raytracing-hlsl.slang
blob: 28420eeec41b2d223ffc48577e9a5bef647a6564 (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
//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -stage raygeneration -entry main -enable-experimental-passes

// Check to ensure we make global ray-tracing objects. Ensure we store into these variables directly and not through a context-pointer.

// CHECK-DAG: %[[RAYTRACING_AS_TYPE:[A-Za-z0-9_]+]] = OpTypeAccelerationStructureKHR
// CHECK-DAG: %[[RAYTRACING_AS_PTR_TYPE:[A-Za-z0-9_]+]] = OpTypePointer UniformConstant %[[RAYTRACING_AS_TYPE]]
// CHECK-DAG: %[[RAYTRACING_AS:[A-Za-z0-9_]+]] = OpVariable %[[RAYTRACING_AS_PTR_TYPE]] UniformConstant

// CHECK-DAG: %[[RAY_PAYLOAD:[A-Za-z0-9_]+]] = OpVariable %{{.*}} RayPayloadKHR

// CHECK: OpLoad {{.*}} %[[RAYTRACING_AS]]
// CHECK: OpTraceRayKHR{{.*}} %[[RAY_PAYLOAD]]

RaytracingAccelerationStructure as;

struct ShadowRay
{
    float hitDistance;
};

void nestedNestedCall()
{
    RayDesc ray = {};

    ShadowRay shadowRay;
    shadowRay.hitDistance = 0;

    TraceRay(as,
            // ray flags
            1,
            // cull mask
            0xff,
            // sbt record offset
            0,
            // sbt record stride
            0,
            // missIndex
            2,
            // ray
            ray,
            // payload
            shadowRay);
}

void nestedCall()
{
    nestedNestedCall();
}

void main()
{
    nestedCall();
}