]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/unused_variable_removal_iteration.glsl
Check the flat qualifier from the correct member
[libs/gl.git] / tests / glsl / unused_variable_removal_iteration.glsl
1 uniform Params
2 {
3         float start_height;
4         float max_height;
5         float min_height;
6         float step_size;
7 };
8
9 #pragma MSP stage(vertex)
10 layout(location=0) in vec4 position;
11 void main()
12 {
13         gl_Position = position;
14         out vec3 dir = vec3(position.xy, 1.0);
15 }
16
17 #pragma MSP stage(fragment)
18 layout(location=0) out vec4 frag_color;
19 void main()
20 {
21         vec3 ndir = normalize(dir);
22         vec3 pos = vec3(0.0, 0.0, start_height);
23         float luminance = 0.0;
24         float extinction = 0.0;
25         while(true)
26         {
27                 if(pos.z<min_height || pos.z>max_height)
28                         break;
29
30                 float density = exp(pos.z/-1000.0);
31                 luminance += density*exp(-extinction);
32
33                 extinction += density*step_size;
34                 pos += ndir*step_size;
35         }
36
37         frag_color = vec4(vec3(luminance), 1.0);
38 }
39
40 // Target API: Vulkan
41
42 /* Expected output: vertex
43 layout(location=0) in vec4 position;
44 layout(location=0) out vec3 dir;
45 void main()
46 {
47         gl_Position = position;
48         dir = vec3(position.xy, 1.0);
49 }
50 */
51
52 /* Expected output: fragment
53 layout(set=0, binding=56) uniform Params
54 {
55         float start_height;
56         float max_height;
57         float min_height;
58         float step_size;
59 };
60 layout(location=0) out vec4 frag_color;
61 layout(location=0) in vec3 dir;
62 void main()
63 {
64         vec3 ndir = normalize(dir);
65         vec3 pos = vec3(0.0, 0.0, start_height);
66         float luminance = 0.0;
67         float extinction = 0.0;
68         while(true)
69         {
70                 if(pos.z<min_height || pos.z>max_height)
71                         break;
72                 float density = exp(pos.z/-1000.0);
73                 luminance += density*exp(-extinction);
74                 extinction += density*step_size;
75                 pos += ndir*step_size;
76         }
77         frag_color = vec4(vec3(luminance), 1.0);
78 }
79 */