]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/complex_constant_condition_removal.glsl
Implement constant folding in the GLSL compiler
[libs/gl.git] / tests / glsl / complex_constant_condition_removal.glsl
diff --git a/tests/glsl/complex_constant_condition_removal.glsl b/tests/glsl/complex_constant_condition_removal.glsl
new file mode 100644 (file)
index 0000000..8a9d96a
--- /dev/null
@@ -0,0 +1,42 @@
+const int lod = 1;
+const int bias = 1;
+const int threshold = 3;
+
+#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(lod+bias<threshold)
+               frag_color = color;
+       else
+               frag_color = vec4(1.0);
+}
+
+/* Expected output: vertex
+layout(location=0) in vec4 position;
+layout(location=1) in vec4 color;
+out vec4 _vs_out_color;
+void main()
+{
+       gl_Position = position;
+       _vs_out_color = color;
+}
+*/
+
+/* Expected output: fragment
+layout(location=0) out vec4 frag_color;
+in vec4 _vs_out_color;
+void main()
+{
+       frag_color = _vs_out_color;
+}
+*/