]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/constant_ternary_removal.glsl
Eliminate constant ternary expressions
[libs/gl.git] / tests / glsl / constant_ternary_removal.glsl
diff --git a/tests/glsl/constant_ternary_removal.glsl b/tests/glsl/constant_ternary_removal.glsl
new file mode 100644 (file)
index 0000000..0270710
--- /dev/null
@@ -0,0 +1,33 @@
+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()
+{
+       frag_color = (use_color ? 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);
+}
+*/