+layout(constant_id=0) const bool use_texture = false;
+layout(constant_id=1) const bool use_vertex_color = false;
+uniform sampler2D tex;
+uniform mat4 mvp;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec4 color;
+layout(location=2) in vec2 texcoord;
+void main()
+{
+ passthrough;
+ gl_Position = mvp*position;
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+ frag_color = vec4(1.0);
+ if(use_texture)
+ frag_color *= texture(tex, texcoord);
+ if(use_vertex_color)
+ frag_color *= color;
+}
+
+// Compile mode: module
+
+/* Expected output: vertex
+uniform mat4 mvp;
+layout(location=0) in vec4 position;
+layout(location=1) in vec4 color;
+layout(location=2) in vec2 texcoord;
+out vec4 _vs_out_color;
+out vec2 _vs_out_texcoord;
+void main()
+{
+ _vs_out_color = color;
+ _vs_out_texcoord = texcoord;
+ gl_Position = mvp*position;
+}
+*/
+
+/* Expected output: fragment
+layout(constant_id=0) const bool use_texture = false;
+layout(constant_id=1) const bool use_vertex_color = false;
+uniform sampler2D tex;
+layout(location=0) out vec4 frag_color;
+in vec2 _vs_out_texcoord;
+in vec4 _vs_out_color;
+void main()
+{
+ frag_color = vec4(1.0);
+ if(use_texture)
+ frag_color *= texture(tex, _vs_out_texcoord);
+ if(use_vertex_color)
+ frag_color *= _vs_out_color;
+}
+*/