yum-mirror/slang

Making it easier to work with shaders

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

ArielG-NVMove SPIRV global variables into a context variable (#4741)04e7327a2

master
1.3 KiB53 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -stage raygeneration -entry main -enable-experimental-passes
2
3// Check to ensure we make global ray-tracing objects. Ensure we store into these variables directly and not through a context-pointer.
4
5// CHECK-DAG: %[[RAYTRACING_AS_TYPE:[A-Za-z0-9_]+]] = OpTypeAccelerationStructureKHR
6// CHECK-DAG: %[[RAYTRACING_AS_PTR_TYPE:[A-Za-z0-9_]+]] = OpTypePointer UniformConstant %[[RAYTRACING_AS_TYPE]]
7// CHECK-DAG: %[[RAYTRACING_AS:[A-Za-z0-9_]+]] = OpVariable %[[RAYTRACING_AS_PTR_TYPE]] UniformConstant
8
9// CHECK-DAG: %[[RAY_PAYLOAD:[A-Za-z0-9_]+]] = OpVariable %{{.*}} RayPayloadKHR
10
11// CHECK: OpLoad {{.*}} %[[RAYTRACING_AS]]
12// CHECK: OpTraceRayKHR{{.*}} %[[RAY_PAYLOAD]]
13
14RaytracingAccelerationStructure as;
15
16struct ShadowRay
17{
18    float hitDistance;
19};
20
21void nestedNestedCall()
22{
23    RayDesc ray = {};
24
25    ShadowRay shadowRay;
26    shadowRay.hitDistance = 0;
27
28    TraceRay(as,
29            // ray flags
30            1,
31            // cull mask
32            0xff,
33            // sbt record offset
34            0,
35            // sbt record stride
36            0,
37            // missIndex
38            2,
39            // ray
40            ray,
41            // payload
42            shadowRay);
43}
44
45void nestedCall()
46{
47    nestedNestedCall();
48}
49
50void main()
51{
52    nestedCall();
53}