summaryrefslogtreecommitdiff
path: root/progs/fpglsl
diff options
context:
space:
mode:
Diffstat (limited to 'progs/fpglsl')
-rw-r--r--progs/fpglsl/dowhile.glsl8
-rw-r--r--progs/fpglsl/dowhile2.glsl10
-rw-r--r--progs/fpglsl/for.glsl11
-rw-r--r--progs/fpglsl/forbreak.glsl13
-rw-r--r--progs/fpglsl/fp-tri.c5
-rw-r--r--progs/fpglsl/simpleif.glsl6
-rw-r--r--progs/fpglsl/while.glsl7
-rw-r--r--progs/fpglsl/while2.glsl9
8 files changed, 69 insertions, 0 deletions
diff --git a/progs/fpglsl/dowhile.glsl b/progs/fpglsl/dowhile.glsl
new file mode 100644
index 0000000000..ed9d729675
--- /dev/null
+++ b/progs/fpglsl/dowhile.glsl
@@ -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
index 0000000000..f3e00b8e86
--- /dev/null
+++ b/progs/fpglsl/dowhile2.glsl
@@ -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/for.glsl b/progs/fpglsl/for.glsl
new file mode 100644
index 0000000000..862ca8bd6c
--- /dev/null
+++ b/progs/fpglsl/for.glsl
@@ -0,0 +1,11 @@
+uniform int KernelSizeInt;
+
+void main() {
+ int i;
+ vec4 sum = vec4(0.0);
+ for (i = 0; i < KernelSizeInt; ++i) {
+ sum.g += 0.25;
+ }
+ sum.a = 1.0;
+ gl_FragColor = sum;
+}
diff --git a/progs/fpglsl/forbreak.glsl b/progs/fpglsl/forbreak.glsl
new file mode 100644
index 0000000000..0b8d957cb0
--- /dev/null
+++ b/progs/fpglsl/forbreak.glsl
@@ -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.0;
+ gl_FragColor = sum;
+}
diff --git a/progs/fpglsl/fp-tri.c b/progs/fpglsl/fp-tri.c
index c9b08fbbad..8af09845dd 100644
--- a/progs/fpglsl/fp-tri.c
+++ b/progs/fpglsl/fp-tri.c
@@ -129,6 +129,11 @@ static void setup_uniforms()
}
{
+ GLint loci = glGetUniformLocationARB(program, "KernelSizeInt");
+ if (loci >= 0)
+ glUniform1i(loci, 4);
+ }
+ {
GLint loc1f = glGetUniformLocationARB(program, "KernelValue1f");
GLint loc2f = glGetUniformLocationARB(program, "KernelValue2f");
GLint loc4f = glGetUniformLocationARB(program, "KernelValue4f");
diff --git a/progs/fpglsl/simpleif.glsl b/progs/fpglsl/simpleif.glsl
new file mode 100644
index 0000000000..922421b410
--- /dev/null
+++ b/progs/fpglsl/simpleif.glsl
@@ -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/while.glsl b/progs/fpglsl/while.glsl
new file mode 100644
index 0000000000..05fb860ddc
--- /dev/null
+++ b/progs/fpglsl/while.glsl
@@ -0,0 +1,7 @@
+void main() {
+ float sum = 0.0;
+ while (sum < 0.499999) {
+ sum += 0.1;
+ }
+ gl_FragColor = vec4(sum);
+}
diff --git a/progs/fpglsl/while2.glsl b/progs/fpglsl/while2.glsl
new file mode 100644
index 0000000000..19c8904e28
--- /dev/null
+++ b/progs/fpglsl/while2.glsl
@@ -0,0 +1,9 @@
+void main() {
+ float sum = 0.0;
+ while (true) {
+ sum += 0.1;
+ if (sum > 0.8)
+ break;
+ }
+ gl_FragColor = vec4(sum);
+}