fpglsl: a few more useful glsl tests
authorZack Rusin <zack@kde.org>
Wed, 10 Mar 2010 21:31:18 +0000 (16:31 -0500)
committerZack Rusin <zack@kde.org>
Wed, 10 Mar 2010 21:32:07 +0000 (16:32 -0500)
progs/fpglsl/dowhile.glsl [new file with mode: 0644]
progs/fpglsl/dowhile2.glsl [new file with mode: 0644]
progs/fpglsl/forbreak.glsl [new file with mode: 0644]
progs/fpglsl/simpleif.glsl [new file with mode: 0644]
progs/fpglsl/while2.glsl [new file with mode: 0644]

diff --git a/progs/fpglsl/dowhile.glsl b/progs/fpglsl/dowhile.glsl
new file mode 100644 (file)
index 0000000..ed9d729
--- /dev/null
@@ -0,0 +1,8 @@
+void main() {
+    float sum = 0.0;
+    do {
+       sum += 0.1;
+       break;
+    } while (true);
+    gl_FragColor = vec4(sum);
+}
diff --git a/progs/fpglsl/dowhile2.glsl b/progs/fpglsl/dowhile2.glsl
new file mode 100644 (file)
index 0000000..f3e00b8
--- /dev/null
@@ -0,0 +1,10 @@
+void main() {
+    float sum = 0.0;
+    do {
+       sum += 0.1;
+       if (sum < 0.499999)
+           continue;
+       break;
+    } while (true);
+    gl_FragColor = vec4(sum);
+}
diff --git a/progs/fpglsl/forbreak.glsl b/progs/fpglsl/forbreak.glsl
new file mode 100644 (file)
index 0000000..87669c6
--- /dev/null
@@ -0,0 +1,13 @@
+uniform int KernelSizeInt;
+
+void main() {
+    int i;
+    vec4 sum = vec4(0.0);
+    for (i = 0; i < KernelSizeInt; ++i) {
+       sum.g += 0.25;
+        if (i > 0)
+           break;
+    }
+    sum.a = 1;
+    gl_FragColor = sum;
+}
diff --git a/progs/fpglsl/simpleif.glsl b/progs/fpglsl/simpleif.glsl
new file mode 100644 (file)
index 0000000..922421b
--- /dev/null
@@ -0,0 +1,6 @@
+void main() {
+    // this should always be true
+    if (gl_FragCoord.x >= 0.0) {
+       gl_FragColor = vec4(0.5, 0.0, 0.5, 1.0);
+    }
+}
diff --git a/progs/fpglsl/while2.glsl b/progs/fpglsl/while2.glsl
new file mode 100644 (file)
index 0000000..19c8904
--- /dev/null
@@ -0,0 +1,9 @@
+void main() {
+    float sum = 0.0;
+    while (true) {
+       sum += 0.1;
+        if (sum > 0.8)
+           break;
+    }
+    gl_FragColor = vec4(sum);
+}