]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/specialization_constants.glsl
Check the flat qualifier from the correct member
[libs/gl.git] / tests / glsl / specialization_constants.glsl
1 layout(constant_id=0) const bool use_texture = false;
2 layout(constant_id=1) const bool use_vertex_color = false;
3 uniform sampler2D tex;
4 layout(push_constant) uniform Transform
5 {
6         mat4 mvp;
7 };
8
9 #pragma MSP stage(vertex)
10 layout(location=0) in vec4 position;
11 layout(location=1) in vec4 color;
12 layout(location=2) in vec2 texcoord;
13 void main()
14 {
15         passthrough;
16         gl_Position = mvp*position;
17 }
18
19 #pragma MSP stage(fragment)
20 layout(location=0) out vec4 frag_color;
21 void main()
22 {
23         frag_color = vec4(1.0);
24         if(use_texture)
25                 frag_color *= texture(tex, texcoord);
26         if(use_vertex_color)
27                 frag_color *= color;
28 }
29
30 // Target API: Vulkan
31 // Specialize: use_texture true
32
33 /* Expected output: vertex
34 layout(push_constant) uniform Transform
35 {
36         mat4 mvp;
37 };
38 layout(location=0) in vec4 position;
39 layout(location=2) in vec2 texcoord;
40 layout(location=0) out vec2 _vs_out_texcoord;
41 void main()
42 {
43         _vs_out_texcoord = texcoord;
44         gl_Position = mvp*position;
45 }
46 */
47
48 /* Expected output: fragment
49 layout(set=0, binding=71) uniform sampler2D tex;
50 layout(location=0) out vec4 frag_color;
51 layout(location=0) in vec2 _vs_out_texcoord;
52 void main()
53 {
54         frag_color = vec4(1.0);
55         frag_color *= texture(tex, _vs_out_texcoord);
56 }
57 */