]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/keep_empty_loop_with_side_effects.glsl
Remove conditional and iteration statements with no effect from GLSL
[libs/gl.git] / tests / glsl / keep_empty_loop_with_side_effects.glsl
1 uniform sampler2D tex;
2
3 #pragma MSP stage(vertex)
4 layout(location=0) in vec4 vertex;
5 layout(location=1) in vec2 texcoord;
6 void main()
7 {
8         gl_Position = vertex;
9         passthrough;
10 }
11
12 #pragma MSP stage(fragment)
13 layout(location=0) out float result;
14 void main()
15 {
16         float value = texture(tex, texcoord).r;
17         float pot;
18         for(pot=0; pot<value; pot*=2) { }
19         result = pot;
20 }
21
22 /* Expected output: vertex
23 layout(location=0) in vec4 vertex;
24 layout(location=1) in vec2 texcoord;
25 layout(location=0) out vec2 _vs_out_texcoord;
26 void main()
27 {
28         gl_Position = vertex;
29         _vs_out_texcoord = texcoord;
30 }
31 */
32
33 /* Expected output: fragment
34 layout(location=0, binding=71) uniform sampler2D tex;
35 layout(location=0) out float result;
36 layout(location=0) in vec2 _vs_out_texcoord;
37 void main()
38 {
39         float value = texture(tex, _vs_out_texcoord).r;
40         float pot;
41         for(pot = 0.0; pot<value; pot *= 2.0) { }
42         result = pot;
43 }
44 */