]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/function_inline_in_iteration.glsl
Add a unit test framework and some tests for the GLSL compiler
[libs/gl.git] / tests / glsl / function_inline_in_iteration.glsl
diff --git a/tests/glsl/function_inline_in_iteration.glsl b/tests/glsl/function_inline_in_iteration.glsl
new file mode 100644 (file)
index 0000000..a98a453
--- /dev/null
@@ -0,0 +1,28 @@
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in float scale;
+float func()
+{
+       float s = scale*2.0;
+       return s*s;
+}
+void main()
+{
+       float p = 1.0;
+       for(float i=func(); i<10.0; i+=2.0)
+               p += i;
+       gl_Position = position*p;
+}
+
+/* Expected output: vertex
+layout(location=0) in vec4 position;
+layout(location=1) in float scale;
+void main()
+{
+       float p = 1.0;
+       float s = scale*2.0;
+       for(float i=s*s; i<10.0; i+=2.0)
+               p += i;
+       gl_Position = position*p;
+}
+*/