]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/empty_conditional_removal.glsl
Check the flat qualifier from the correct member
[libs/gl.git] / tests / glsl / empty_conditional_removal.glsl
1 uniform Lighting
2 {
3         vec3 light_dir;
4         mat4 shadow_matrix;
5         int shadow_enabled;
6 };
7 uniform Transform
8 {
9         mat4 vp;
10         mat4 model;
11 };
12 uniform sampler2DShadow shadow_map;
13 const bool use_light = false;
14
15 #pragma MSP stage(vertex)
16 layout(location=0) in vec4 vertex;
17 layout(location=1) in vec3 normal;
18 void main()
19 {
20         vec4 world_vertex = model*vertex;
21         out vec3 world_normal = mat3(model)*normal;
22         gl_Position = vp*world_vertex;
23         if(shadow_enabled!=0)
24         {
25                 out vec3 shadow_coord = (shadow_matrix*world_vertex).xyz;
26         }
27 }
28
29 #pragma MSP stage(fragment)
30 layout(location=0) out vec4 frag_color;
31 void main()
32 {
33         vec3 color = vec3(1.0);
34         if(use_light)
35         {
36                 float intensity = max(dot(normalize(world_normal), light_dir), 0.0);
37                 if(shadow_enabled!=0)
38                         intensity *= texture(shadow_map, shadow_coord);
39                 color *= intensity;
40         }
41         frag_color = vec4(color, 1.0);
42 }
43
44 // Target API: Vulkan
45
46 /* Expected output: vertex
47 layout(set=0, binding=24) uniform Transform
48 {
49         mat4 vp;
50         mat4 model;
51 };
52 layout(location=0) in vec4 vertex;
53 void main()
54 {
55         gl_Position = vp*model*vertex;
56 }
57 */
58
59 /* Expected output: fragment
60 layout(location=0) out vec4 frag_color;
61 void main()
62 {
63         frag_color = vec4(vec3(1.0), 1.0);
64 }
65 */