]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/keep_spec_constants_in_module.glsl
7b9f98c8f690277e889f2a2e2a4dab50c483d807
[libs/gl.git] / tests / glsl / keep_spec_constants_in_module.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 // Compile mode: module
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=1) in vec4 color;
40 layout(location=2) in vec2 texcoord;
41 layout(location=0) out vec4 _vs_out_color;
42 layout(location=1) out vec2 _vs_out_texcoord;
43 void main()
44 {
45         _vs_out_color = color;
46         _vs_out_texcoord = texcoord;
47         gl_Position = mvp*position;
48 }
49 */
50
51 /* Expected output: fragment
52 layout(constant_id=0) const bool use_texture = false;
53 layout(constant_id=1) const bool use_vertex_color = false;
54 layout(set=0, binding=71) uniform sampler2D tex;
55 layout(location=0) out vec4 frag_color;
56 layout(location=1) in vec2 _vs_out_texcoord;
57 layout(location=0) in vec4 _vs_out_color;
58 void main()
59 {
60   frag_color = vec4(1.0);
61   if(use_texture)
62     frag_color *= texture(tex, _vs_out_texcoord);
63   if(use_vertex_color)
64     frag_color *= _vs_out_color;
65 }
66 */