]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/constant_condition_removal.glsl
Add a unit test framework and some tests for the GLSL compiler
[libs/gl.git] / tests / glsl / constant_condition_removal.glsl
diff --git a/tests/glsl/constant_condition_removal.glsl b/tests/glsl/constant_condition_removal.glsl
new file mode 100644 (file)
index 0000000..08a61fd
--- /dev/null
@@ -0,0 +1,36 @@
+const bool use_color = false;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec4 color;
+void main()
+{
+       gl_Position = position;
+       passthrough;
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+       if(use_color)
+               frag_color = color;
+       else
+               frag_color = vec4(1.0);
+}
+
+/* Expected output: vertex
+layout(location=0) in vec4 position;
+void main()
+{
+       gl_Position = position;
+}
+*/
+
+/* Expected output: fragment
+layout(location=0) out vec4 frag_color;
+void main()
+{
+       frag_color = vec4(1.0);
+}
+*/