]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/keep_used_function.glsl
Resolve functions after inlining expressions
[libs/gl.git] / tests / glsl / keep_used_function.glsl
diff --git a/tests/glsl/keep_used_function.glsl b/tests/glsl/keep_used_function.glsl
new file mode 100644 (file)
index 0000000..419f3f2
--- /dev/null
@@ -0,0 +1,26 @@
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 scale;
+float square(float arg)
+{
+       return arg*arg;
+}
+void main()
+{
+       float x_sq = square(scale.x);
+       float y_sq = square(scale.y);
+       gl_Position = position*sqrt(x_sq+y_sq);
+}
+
+/* Expected output: vertex
+layout(location=0) in vec4 position;
+layout(location=1) in vec2 scale;
+float square(float arg)
+{
+       return arg*arg;
+}
+void main()
+{
+       gl_Position = position*sqrt(square(scale.x)+square(scale.y));
+}
+*/