]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/constant_last_argument.glsl
Implement constant folding in the GLSL compiler
[libs/gl.git] / tests / glsl / constant_last_argument.glsl
diff --git a/tests/glsl/constant_last_argument.glsl b/tests/glsl/constant_last_argument.glsl
new file mode 100644 (file)
index 0000000..b73f182
--- /dev/null
@@ -0,0 +1,40 @@
+uniform sampler2D tex;
+uniform mat4 mvp;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 texcoord;
+void main()
+{
+       gl_Position = mvp*position;
+       passthrough;
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+       frag_color = textureLod(tex, texcoord, 0.0)*0.8;
+}
+
+/* Expected output: vertex
+uniform mat4 mvp;
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 texcoord;
+out vec2 _vs_out_texcoord;
+void main()
+{
+       gl_Position = mvp*position;
+       _vs_out_texcoord = texcoord;
+}
+*/
+
+/* Expected output: fragment
+uniform sampler2D tex;
+layout(location=0) out vec4 frag_color;
+in vec2 _vs_out_texcoord;
+void main()
+{
+       frag_color = textureLod(tex, _vs_out_texcoord, 0.0)*0.8;
+}
+*/