+uniform Lighting
+{
+ vec3 light_dir;
+ mat4 shadow_matrix;
+ int shadow_enabled;
+};
+uniform Transform
+{
+ mat4 vp;
+ mat4 model;
+};
+uniform sampler2DShadow shadow_map;
+const bool use_light = false;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 vertex;
+layout(location=1) in vec3 normal;
+void main()
+{
+ vec4 world_vertex = model*vertex;
+ out vec3 world_normal = mat3(model)*normal;
+ gl_Position = vp*world_vertex;
+ if(shadow_enabled!=0)
+ {
+ out vec3 shadow_coord = (shadow_matrix*world_vertex).xyz;
+ }
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+ vec3 color = vec3(1.0);
+ if(use_light)
+ {
+ float intensity = max(dot(normalize(world_normal), light_dir), 0.0);
+ if(shadow_enabled!=0)
+ intensity *= texture(shadow_map, shadow_coord);
+ color *= intensity;
+ }
+ frag_color = vec4(color, 1.0);
+}
+
+/* Expected output: vertex
+layout(binding=48) uniform Transform
+{
+ mat4 vp;
+ mat4 model;
+};
+layout(location=0) in vec4 vertex;
+void main()
+{
+ gl_Position = vp*model*vertex;
+}
+*/
+
+/* Expected output: fragment
+layout(location=0) out vec4 frag_color;
+void main()
+{
+ frag_color = vec4(vec3(1.0), 1.0);
+}
+*/