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.2 KiB35 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -allow-glsl -target spirv -emit-spirv-directly -stage vertex -entry vertexMain -enable-experimental-passes
2
3// Check to ensure varying output/input and builtin is not moved into a kernelContext (part of entry-point). Ensure varying output/input and builtin is referenced directly.
4
5// CHECK: OpEntryPoint{{((.*)(%.*data1In|%.*data2In|%.*data1Out)(.*))|((.*)(%.*data1In|%.*data2In|%.*data1Out)(.*))|((.*)(%.*data1In|%.*data2In|%.*data1Out)(.*))}}
6
7//CHECK-DAG: OpDecorate %[[DATA_IN_1:.*data1In]] Location 1
8//CHECK-DAG: OpDecorate %[[DATA_IN_2:.*data2In]] Location 2
9//CHECK-DAG: OpDecorate %[[DATA_OUT_1:.*data1Out]] Location 0
10//CHECK-DAG: OpDecorate %gl_Position BuiltIn Position
11
12//CHECK-DAG: %[[DATA_IN_1]] = OpVariable{{.*}} Input
13//CHECK-DAG: %[[DATA_IN_2]] = OpVariable{{.*}} Input
14//CHECK-DAG: %[[DATA_OUT_1]] = OpVariable{{.*}} Output
15
16//CHECK-DAG: OpLoad{{.*}} %[[DATA_IN_1]]
17//CHECK-DAG: OpLoad{{.*}} %[[DATA_IN_2]]
18
19//CHECK-DAG: OpStore %gl_Position
20//CHECK-DAG: OpStore %[[DATA_OUT_1]]
21
22layout(location = 1) in vec4 data1In;
23layout(location = 2) in int data2In;
24layout(location = 0) out int data1Out;
25
26void nestedCall()
27{
28    gl_Position = data1In;
29    data1Out = data2In;
30}
31
32void vertexMain()
33{
34    nestedCall();
35}